8311990: Two JDI tests may interfere with each other

Reviewed-by: dholmes, sspitsyn
This commit is contained in:
Alex Menkov 2024-08-06 21:56:48 +00:00
parent 6733b89de1
commit 920751e5d5
2 changed files with 17 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -50,7 +50,8 @@ public class JdwpListenTest {
// 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;
private static boolean allowNegativeTesting =
"true".equalsIgnoreCase(System.getProperty("jdk.jdi.allowNegativeTesting"));
public static void main(String[] args) throws Exception {
List<InetAddress> addresses = Utils.getAddressesWithSymbolicAndNumericScopes();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -49,6 +49,11 @@ import java.util.Objects;
*/
public class JdwpNetProps {
// Set to true to allow testing of attach from wrong address (expected to fail).
// It's off by default as it causes test interference (see JDK-8311990).
private static boolean allowNegativeAttachTesting =
"true".equalsIgnoreCase(System.getProperty("jdk.jdi.allowNegativeTesting"));
public static void main(String[] args) throws Exception {
InetAddress addrs[] = InetAddress.getAllByName("localhost");
InetAddress ipv4Address = null;
@ -171,6 +176,14 @@ public class JdwpNetProps {
}
public void run(TestResult expectedResult) throws Exception {
log("\nTest: listen at " + listenAddress + ", attaching to " + connectAddress
+ ", preferIPv4Stack = " + preferIPv4Stack
+ ", preferIPv6Addresses = " + preferIPv6Addresses
+ ", expectedResult = " + expectedResult);
if (expectedResult == TestResult.AttachFailed && !allowNegativeAttachTesting) {
log("SKIPPED: negative attach testing is disabled");
return;
}
List<String> options = new LinkedList<>();
if (preferIPv4Stack != null) {
options.add("-Djava.net.preferIPv4Stack=" + preferIPv4Stack.toString());