Java test failure

75 views
Skip to first unread message

Jesper

unread,
Aug 20, 2009, 10:19:54 AM8/20/09
to Protocol Buffers
I'm trying to build Protobufs 2.2.0 on Windows, but I get test
failures I don't known what to do with:

JesperEs@seupp-jesper2 $ ~/apache-maven-2.1.0-bin/apache-maven-2.1.0/
bin/mvn.bat package -e
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[INFO] Building Protocol Buffer Java API
[INFO] task-segment: [package]
[INFO]
------------------------------------------------------------------------
[INFO] [antrun:run {execution: generate-sources}]
[INFO] Executing tasks
[INFO] Executed tasks
[INFO] Registering compile source root e:\dev\ide-platform\core\ide
\protobuf\java\target\generated-sources
[INFO] [resources:resources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory e:\dev\ide-platform\core\ide
\protobuf\java\src\main\resources
[INFO] [compiler:compile]
[INFO] Compiling 1 source file to e:\dev\ide-platform\core\ide\protobuf
\java\target\classes
[INFO] [antrun:run {execution: generate-test-sources}]
[INFO] Executing tasks
[INFO] Executed tasks
[INFO] Registering compile test source root e:\dev\ide-platform\core
\ide\protobuf\java\target\generated-test-sources
[INFO] [resources:testResources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory e:\dev\ide-platform\core\ide
\protobuf\java\src\test\resources
[INFO] [compiler:testCompile]
[INFO] Compiling 13 source files to e:\dev\ide-platform\core\ide
\protobuf\java\target\test-classes
[INFO] [surefire:test]
[INFO] Surefire report directory: e:\dev\ide-platform\core\ide\protobuf
\java\target\surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.google.protobuf.TextFormatTest
Tests run: 19, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.078
sec <<< FAILURE!
Running com.google.protobuf.ServiceTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.172
sec
Running com.google.protobuf.LiteTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031
sec
Running com.google.protobuf.GeneratedMessageTest
Tests run: 44, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.063
sec
Running com.google.protobuf.CodedInputStreamTest
Tests run: 13, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.156
sec
Running com.google.protobuf.WireFormatTest
Tests run: 17, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031
sec
Running com.google.protobuf.DynamicMessageTest
Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031
sec
Running com.google.protobuf.UnknownFieldSetTest
Tests run: 17, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047
sec
Running com.google.protobuf.DescriptorsTest
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.328
sec
Running com.google.protobuf.CodedOutputStreamTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016
sec
Running com.google.protobuf.MessageTest
Tests run: 17, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016
sec
Running com.google.protobuf.AbstractMessageTest
Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047
sec

Results :

Failed tests:
testPrintMessage(com.google.protobuf.TextFormatTest)
testPrintExtensions(com.google.protobuf.TextFormatTest)

Tests run: 179, Failures: 2, Errors: 0, Skipped: 0

[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] There are test failures.

Please refer to e:\dev\ide-platform\core\ide\protobuf\java\target
\surefire-reports for the individual test results.
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: There are test failures.

Please refer to e:\dev\ide-platform\core\ide\protobuf\java\target
\surefire-reports for the individual test results.
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:699)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
(DefaultLifecycleExecutor.java:540)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
(DefaultLifecycleExecutor.java:519)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:371)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments
(DefaultLifecycleExecutor.java:332)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
(DefaultLifecycleExecutor.java:181)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:
356)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:
137)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced
(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode
(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoFailureException: There are
test failures.

Please refer to e:\dev\ide-platform\core\ide\protobuf\java\target
\surefire-reports for the individual test results.
at org.apache.maven.plugin.surefire.SurefirePlugin.execute
(SurefirePlugin.java:575)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo
(DefaultPluginManager.java:483)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:678)
... 16 more
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 14 seconds
[INFO] Finished at: Thu Aug 20 16:18:20 CEST 2009
[INFO] Final Memory: 14M/63M
[INFO]
------------------------------------------------------------------------
JesperEs@seupp-jesper2 $



No jar seems to be generated, so I can't continue, ignoring the
failures.

Kenton Varda

unread,
Aug 20, 2009, 3:56:14 PM8/20/09
to Jesper, Protocol Buffers
According to a google search for "maven skip tests", you can skip them by specifying "-Dmaven.test.skip=true" on the command line.

Of course, it would be nice to know why the tests are failing.  Can you send us the test result reports mentioned in the error log?

Jesper

unread,
Aug 21, 2009, 4:19:35 AM8/21/09
to Protocol Buffers


On Aug 20, 9:56 pm, Kenton Varda <ken...@google.com> wrote:
> According to a google search for "maven skip tests", you can skip them by
> specifying "-Dmaven.test.skip=true" on the command line.
> Of course, it would be nice to know why the tests are failing.  Can you send
> us the test result reports mentioned in the error log?

I solved the problem. The protoc.exe I put in the src/ directory was
actually version 2.0.3, and not 2.2.0. Building a new one and using
that instead solved the problem.

--
/Jesper

Jesper Eskilson

unread,
Aug 21, 2009, 6:10:46 AM8/21/09
to Protocol Buffers
I was a little fast on my reply. If I build directly from the
protobuf-2.2.0.zip I downloaded, things work fine, but when I build in
the working copy of our local vendor branch, I get the failure above.
However, I can't see what changes I've made to our local branch that
could possible affect the test result. Looking at the failure logs
(see attached files) it seems as if the formatted messages have
windows-style EOL, while the tests expects unix-style EOL.

See attached failure logs.

--
/Jesper
com.google.protobuf.TextFormatTest.txt
TEST-com.google.protobuf.TextFormatTest.xml

Kenton Varda

unread,
Aug 21, 2009, 3:06:13 PM8/21/09
to Jesper Eskilson, Protocol Buffers
Indeed, if you downloaded the zip file, then all the text files have windows-style newlines, including the text format golden files.  And it looks like the test code isn't dealing with this correctly.  I wonder why this never came up before...

I think this can be fixed by changing TestUtil.java around line 3556 from:

  public static String readTextFromFile(String filePath) {
    return readBytesFromFile(filePath).toStringUtf8();
  }

to:

  public static String readTextFromFile(String filePath) {
    return readBytesFromFile(filePath).toStringUtf8().replace("\r\n", "\n");
  }

Can you let me know if this works?
Reply all
Reply to author
Forward
0 new messages