changeset 56932:439a147b2c0c

8231915: two JDI tests interfere with each other Reviewed-by: sspitsyn, dtitov
author amenkov
date Wed, 13 Nov 2019 14:08:04 -0800
parents 5f458adec06b
children f080b08daace
files test/jdk/com/sun/jdi/JdwpListenTest.java
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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) {