8231915: two JDI tests interfere with each other
authoramenkov
Wed, 13 Nov 2019 14:08:04 -0800
changeset 59066 439a147b2c0c
parent 59065 5f458adec06b
child 59067 f080b08daace
8231915: two JDI tests interfere with each other Reviewed-by: sspitsyn, dtitov
test/jdk/com/sun/jdi/JdwpListenTest.java
--- a/test/jdk/com/sun/jdi/JdwpListenTest.java	Wed Nov 13 13:05:16 2019 -0800
+++ b/test/jdk/com/sun/jdi/JdwpListenTest.java	Wed Nov 13 14:08:04 2019 -0800
@@ -54,6 +54,10 @@
 
     private static final boolean IsWindows = System.getProperty("os.name").toLowerCase().contains("windows");
 
+    // Set to true to allow testing of attach from wrong address (expected to fail).
+    // It's off by default as it causes test time increase and test interference (see JDK-8231915).
+    private static boolean allowNegativeTesting = false;
+
     public static void main(String[] args) throws Exception {
         List<InetAddress> addresses = getAddresses();
 
@@ -87,6 +91,11 @@
             throws IOException {
         log("\nTest: listen at " + listenAddress + ", attaching from " + connectAddress
                 + ", expected: " + (expectedResult ? "SUCCESS" : "FAILURE"));
+        if (!expectedResult && !allowNegativeTesting) {
+            log("SKIPPED: negative testing is disabled");
+            return;
+        }
+
         log("Starting listening debuggee at " + listenAddress);
         try (Debuggee debuggee = Debuggee.launcher("HelloWorld").setAddress(listenAddress + ":0").launch()) {
             log("Debuggee is listening on " + listenAddress + ":" + debuggee.getAddress());
@@ -103,6 +112,7 @@
                 }
             }
         }
+        log("PASSED");
     }
 
     private static void addAddr(List<InetAddress> list, InetAddress addr) {