Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8351639

Improve debuggability of test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java test

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 25
    • 18
    • tools
    • master

      The test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java test has failed intermittently with the following exception:

      test JdiHangingListenExecutionControlTest.hangListenTimeoutTest(): failure [8015ms]
      java.lang.AssertionError: Launching JShell execution engine threw: Failed remote listen: java.util.concurrent.ExecutionException: com.sun.jdi.connect.TransportTimeoutException: timeout waiting for connection @ com.sun.jdi.SocketListen (defaults: timeout=, port=, localAddress=) -- {timeout=timeout=8000, port=port=12345, localAddress=localAddress=} expected [true] but found [false]
          at org.testng.Assert.fail(Assert.java:99)
          at org.testng.Assert.failNotEquals(Assert.java:1037)
          at org.testng.Assert.assertTrue(Assert.java:45)
          at JdiHangingListenExecutionControlTest.hangListenTimeoutTest(JdiHangingListenExecutionControlTest.java:49)

      The test verifies the exception message in an IllegalStateException that gets thrown and if that exception message doesn't match the expectation then it fails the test:

          try {
              System.err.printf("Unexpected return value: %s\n",
                      HangingRemoteAgent.state(false, null).eval("33;"));
          } catch (IllegalStateException ex) {
              assertTrue(ex.getMessage().startsWith(EXPECTED_ERROR), ex.getMessage());
              return;
          }

      In its current form, we lose the useful information in the IllegalStateException and thus it's hard to understand why the test failed. It would be better to rethrow the original exception if the exception message doesn't meet the expectations.

            jpai Jaikiran Pai
            jpai Jaikiran Pai
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: