< prev index next >

tools/FxTestRunner/src/client/test/runner/CommonTestRunnerWorker.java

Print this page
rev 319 : 8160349: [TEST BUG] Hanged test blocks port and breaks following tests
Summary: Now each test uses random free port and test runner correctly handles interrupts from javatest.

@@ -43,11 +43,11 @@
  *
  * @author shura, mrkam, Sergey Grinev, Victor Shubov
  */
 public class CommonTestRunnerWorker {
 
-    static final int PORT = 56179;

+    static final int DEFAULT_PORT = 56179;

 
     private final JUnitCore core = new JUnitCore();
     private Abstract2TestRunner testRunner;
     private final Semaphore uilock = new Semaphore(0);
     private Socket socket;

@@ -75,10 +75,13 @@
             waitUI();
             exit(testRunner.getCurrentStatus());
         }
     }, "exit waiter");
 
+    static int getTestPort() {

+        return Integer.valueOf(System.getProperty("masterPort", String.valueOf(DEFAULT_PORT)));

+    }

     /**
      *
      * @throws Throwable
      */
     public void runUI() throws Throwable {

@@ -182,12 +185,13 @@
             return;
         }
 
         testStart = System.nanoTime();
         try {
-            report("Looking for server at host " + host + ", port " + PORT + "...");

-            socket = new Socket(host, PORT);

+            int port = getTestPort();

+            report("Looking for server at host " + host + ", port " + port + "...");

+            socket = new Socket(host, port);

             ObjectInputStream readerStream = new ObjectInputStream(socket.getInputStream());
             report("Connected");
 
             loop:
             do {
< prev index next >