Improve `PantsRunnerTest` setup error message.

Review Request #4038 - Created June 30, 2016 and submitted

Information
John Sirois
pants
jsirois/issues/3615
3615, 3616
79e5322...
Reviewers
pants-reviews
patricklaw, peiyu, zundel
This is in support of debugging OSX CI failures under Jenkins but is
also generally more friendly.

 tests/java/org/pantsbuild/tools/runner/PantsRunnerTest.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 54 insertions(+), 2 deletions(-)

Verified the capture code worked with:

$ git diff -U1
diff --git a/tests/java/org/pantsbuild/tools/runner/PantsRunnerTest.java b/tests/java/org/pantsbuild/tools/runner/PantsRunnerTest.java
index 864f096..271c4ab 100644
--- a/tests/java/org/pantsbuild/tools/runner/PantsRunnerTest.java
+++ b/tests/java/org/pantsbuild/tools/runner/PantsRunnerTest.java
@@ -83,3 +83,3 @@ public class PantsRunnerTest {
             stderr.readAll()),
-        0,
+        42,
         result);

Yielding:

$ ./pants test tests/java/org/pantsbuild/tools/runner:jar
...

16:00:23 00:03     [junit]
16:00:23 00:03       [run]
                     OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
                     OpenJDK 64-Bit Server VM warning: ignoring option UseSplitVerifier; support was removed in 8.0
                     Auto-detected 8 processors, using -parallel-threads=8
                     F
                     Time: 3.73
                     There was 1 failure:
                     1) org.pantsbuild.tools.runner.PantsRunnerTest
                     java.lang.AssertionError: Problem running ./pants bundle testprojects/src/java/org/pantsbuild/testproject/runner:pants-runner-testproject - exited with 0:
                     STDOUT:

                     16:00:26 00:00 [main]
                                    (To run a reporting server: ./pants server)
                     16:00:26 00:00   [setup]
                     16:00:26 00:00     [parse]
                                    Executing tasks in goals: bootstrap -> imports -> unpack-jars -> deferred-sources -> gen -> jvm-platform-validate -> resolve -> resources -> compile -> binary -> apk -> sign -> bundle
                     16:00:26 00:00   [bootstrap]
                     16:00:26 00:00     [substitute-aliased-targets]
                     16:00:26 00:00     [jar-dependency-management]
                     16:00:26 00:00     [bootstrap-jvm-tools]
                     16:00:26 00:00     [provide-tools-jar]
...
                     16:00:27 00:01   [complete]
                                    SUCCESS


                     STDERR:
                      expected:<42> but was:<0>
                        at org.junit.Assert.fail(Assert.java:88)
                        at org.junit.Assert.failNotEquals(Assert.java:834)
                        at org.junit.Assert.assertEquals(Assert.java:645)
                        at org.pantsbuild.tools.runner.PantsRunnerTest.setUpClass(PantsRunnerTest.java:77)
...

CI went green here:
http://jenkins.pantsbuild.org/job/pantsbuild/job/pants/job/PR-3616/10/

John Sirois
Eric Ayers
Eric Ayers
Peiyu Wang
Ity Kaul
John Sirois
Eric Ayers
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Change Summary:

Now on master:

git log -1 origin/master
commit 6ac25c8c42142496d691f0e603899352f2b19807
Author: John Sirois <john.sirois@gmail.com>
Date:   Fri Jul 1 09:29:16 2016 -0600

    Improve `PantsRunnerTest` setup error message.
    
    This is in support of debugging OSX CI failures under Jenkins but is
    also generally more friendly.
    
    Testing Done:
    Verified the capture code worked with:
    ```diff
    $ git diff -U1
    diff --git a/tests/java/org/pantsbuild/tools/runner/PantsRunnerTest.java b/tests/java/org/pantsbuild/tools/runner/PantsRunnerTest.java
    index 864f096..271c4ab 100644
    --- a/tests/java/org/pantsbuild/tools/runner/PantsRunnerTest.java
    +++ b/tests/java/org/pantsbuild/tools/runner/PantsRunnerTest.java
    @@ -83,3 +83,3 @@ public class PantsRunnerTest {
                 stderr.readAll()),
    -        0,
    +        42,
             result);
    ```
    
    Yielding:
    ```
    $ ./pants test tests/java/org/pantsbuild/tools/runner:jar
    ...
    
    16:00:23 00:03     [junit]
    16:00:23 00:03       [run]
                         OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
                         OpenJDK 64-Bit Server VM warning: ignoring option UseSplitVerifier; support was removed in 8.0
                         Auto-detected 8 processors, using -parallel-threads=8
                         F
                         Time: 3.73
                         There was 1 failure:
                         1) org.pantsbuild.tools.runner.PantsRunnerTest
                         java.lang.AssertionError: Problem running ./pants bundle testprojects/src/java/org/pantsbuild/testproject/runner:pants-runner-testproject - exited with 0:
                         STDOUT:
    
                         16:00:26 00:00 [main]
                                        (To run a reporting server: ./pants server)
                         16:00:26 00:00   [setup]
                         16:00:26 00:00     [parse]
                                        Executing tasks in goals: bootstrap -> imports -> unpack-jars -> deferred-sources -> gen -> jvm-platform-validate -> resolve -> resources -> compile -> binary -> apk -> sign -> bundle
                         16:00:26 00:00   [bootstrap]
                         16:00:26 00:00     [substitute-aliased-targets]
                         16:00:26 00:00     [jar-dependency-management]
                         16:00:26 00:00     [bootstrap-jvm-tools]
                         16:00:26 00:00     [provide-tools-jar]
    ...
                         16:00:27 00:01   [complete]
                                        SUCCESS
    
                         STDERR:
                          expected:<42> but was:<0>
                            at org.junit.Assert.fail(Assert.java:88)
                            at org.junit.Assert.failNotEquals(Assert.java:834)
                            at org.junit.Assert.assertEquals(Assert.java:645)
                            at org.pantsbuild.tools.runner.PantsRunnerTest.setUpClass(PantsRunnerTest.java:77)
    ...
    ```
    
    CI went green here:
      http://jenkins.pantsbuild.org/job/pantsbuild/job/pants/job/PR-3616/10/
    
    Bugs closed: 3615, 3616
    
    Reviewed at https://rbcommons.com/s/twitter/r/4038/
Loading...