mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-19 04:13:07 +00:00
8366659: Fixed semi-broken tests
This commit is contained in:
parent
8283d9c0c2
commit
d45fc76b0d
@ -28,7 +28,7 @@
|
||||
* @requires vm.jvmti
|
||||
* @library /test/lib
|
||||
* @compile SuspendWithObjectMonitorWait1.java
|
||||
* @run main/othervm/native -agentlib:SuspendWithObjectMonitorWait SuspendWithObjectMonitorWait1
|
||||
* @run main/othervm/native -agentlib:SuspendWithObjectMonitorWait SuspendWithObjectMonitorWait1 1
|
||||
*/
|
||||
|
||||
import java.io.PrintStream;
|
||||
@ -70,7 +70,7 @@ public class SuspendWithObjectMonitorWait1 extends SuspendWithObjectMonitorWaitB
|
||||
SuspendWithObjectMonitorWaitWorker waiter; // waiter thread
|
||||
SuspendWithObjectMonitorWaitWorker resumer; // resumer thread
|
||||
|
||||
System.out.println("About to execute for " + timeMax + " seconds.");
|
||||
System.out.println("Test 1: About to execute for " + timeMax + " seconds.");
|
||||
|
||||
long start_time = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() < start_time + (timeMax * 1000)) {
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
* @requires vm.jvmti
|
||||
* @library /test/lib
|
||||
* @compile SuspendWithObjectMonitorWait2.java
|
||||
* @run main/othervm/native -agentlib:SuspendWithObjectMonitorWait SuspendWithObjectMonitorWait2
|
||||
* @run main/othervm/native -agentlib:SuspendWithObjectMonitorWait SuspendWithObjectMonitorWait2 2
|
||||
*/
|
||||
|
||||
import java.io.PrintStream;
|
||||
@ -79,7 +79,7 @@ public class SuspendWithObjectMonitorWait2 extends SuspendWithObjectMonitorWaitB
|
||||
SuspendWithObjectMonitorWaitWorker waiter; // waiter thread
|
||||
SuspendWithObjectMonitorWaitWorker resumer; // resumer thread
|
||||
|
||||
System.out.println("About to execute for " + timeMax + " seconds.");
|
||||
System.out.println("Test 2: About to execute for " + timeMax + " seconds.");
|
||||
|
||||
long start_time = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() < start_time + (timeMax * 1000)) {
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
* @requires vm.jvmti
|
||||
* @library /test/lib
|
||||
* @compile SuspendWithObjectMonitorWait3.java
|
||||
* @run main/othervm/native -agentlib:SuspendWithObjectMonitorWait SuspendWithObjectMonitorWait3
|
||||
* @run main/othervm/native -agentlib:SuspendWithObjectMonitorWait SuspendWithObjectMonitorWait3 3
|
||||
*/
|
||||
|
||||
import java.io.PrintStream;
|
||||
@ -85,7 +85,7 @@ public class SuspendWithObjectMonitorWait3 extends SuspendWithObjectMonitorWaitB
|
||||
SuspendWithObjectMonitorWaitWorker waiter; // waiter thread
|
||||
SuspendWithObjectMonitorWaitWorker resumer; // resumer thread
|
||||
|
||||
System.out.println("About to execute for " + timeMax + " seconds.");
|
||||
System.out.println("Test 3: About to execute for " + timeMax + " seconds.");
|
||||
|
||||
long start_time = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() < start_time + (timeMax * 1000)) {
|
||||
|
||||
@ -145,7 +145,12 @@ public class SuspendWithObjectMonitorWaitBase {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
if (args.length > 2) {
|
||||
if (args.length == 0) {
|
||||
System.err.println("Invalid number of arguments, there should be at least a test_case given.");
|
||||
usage();
|
||||
}
|
||||
|
||||
if (args.length > 3) {
|
||||
System.err.println("Invalid number of arguments, there are too many arguments.");
|
||||
usage();
|
||||
}
|
||||
@ -159,14 +164,32 @@ public class SuspendWithObjectMonitorWaitBase {
|
||||
throw ule;
|
||||
}
|
||||
|
||||
int testCase = 0;
|
||||
int timeMax = 0;
|
||||
for (int argIndex = 0; argIndex < args.length; argIndex++) {
|
||||
if ("-p".equals(args[argIndex])) {
|
||||
if (args[argIndex].equals("-p")) {
|
||||
// Handle optional -p arg regardless of position.
|
||||
printDebug = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (testCase == 0) {
|
||||
try {
|
||||
// testCase must be the first non-optional arg.
|
||||
testCase = Integer.parseUnsignedInt(args[argIndex]);
|
||||
log("testCase = " + testCase);
|
||||
} catch (NumberFormatException nfe) {
|
||||
System.err.println("'" + args[argIndex] +
|
||||
"': invalid test_case value.");
|
||||
usage();
|
||||
}
|
||||
if (testCase < 1 || testCase > 3) {
|
||||
System.err.println("Invalid test_case value: '" + testCase + "'");
|
||||
usage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (argIndex < args.length) {
|
||||
// timeMax is an optional arg.
|
||||
try {
|
||||
@ -180,7 +203,33 @@ public class SuspendWithObjectMonitorWaitBase {
|
||||
timeMax = DEF_TIME_MAX;
|
||||
}
|
||||
}
|
||||
SuspendWithObjectMonitorWaitBase test = new SuspendWithObjectMonitorWaitBase();
|
||||
|
||||
if (timeMax == 0) {
|
||||
timeMax = DEF_TIME_MAX;
|
||||
}
|
||||
log("timeMax = " + timeMax);
|
||||
|
||||
if (testCase == 0) {
|
||||
// Just -p was given.
|
||||
System.err.println("Invalid number of arguments, no test_case given.");
|
||||
usage();
|
||||
}
|
||||
|
||||
SuspendWithObjectMonitorWaitBase test = null;
|
||||
switch (testCase) {
|
||||
case 1:
|
||||
test = new SuspendWithObjectMonitorWait1();
|
||||
break;
|
||||
case 2:
|
||||
test = new SuspendWithObjectMonitorWait2();
|
||||
break;
|
||||
case 3:
|
||||
test = new SuspendWithObjectMonitorWait3();
|
||||
break;
|
||||
default:
|
||||
// Impossible
|
||||
break;
|
||||
}
|
||||
int result = test.run(timeMax, System.out);
|
||||
System.exit(result + exit_delta);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user