Skip to content

Commit 19eabaf

Browse files
author
Markus Grönlund
committed
8353227: JFR: Prepare tests for strong parser validation
Reviewed-by: egahlin
1 parent 564066d commit 19eabaf

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

test/jdk/jdk/jfr/api/consumer/streaming/TestJVMCrash.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,26 @@
4040
*/
4141
public class TestJVMCrash {
4242

43+
/*
44+
* We don't run if -esa is specified, because parser invariants are not
45+
* guaranteed for emergency dumps, which are provided on a best-effort basis only.
46+
*/
47+
private static boolean hasIncompatibleTestOptions() {
48+
String testVmOpts[] = System.getProperty("test.vm.opts","").split("\\s+");
49+
for (String s : testVmOpts) {
50+
if (s.equals("-esa")) {
51+
System.out.println("Incompatible option: " + s + " specified. Skipping test.");
52+
return true;
53+
}
54+
}
55+
return false;
56+
}
57+
4358
public static void main(String... args) {
59+
if (hasIncompatibleTestOptions()) {
60+
return;
61+
}
62+
4463
int id = 1;
4564
while (true) {
4665
try (TestProcess process = new TestProcess("crash-application-" + id++, false /* createCore */)) {

test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,26 @@ public class TestShutdownEvent {
6464
new TestSig("INT")
6565
};
6666

67+
/*
68+
* We don't run if -esa is specified, because parser invariants are not
69+
* guaranteed for emergency dumps, which are provided on a best-effort basis only.
70+
*/
71+
private static boolean hasIncompatibleTestOptions() {
72+
String testVmOpts[] = System.getProperty("test.vm.opts","").split("\\s+");
73+
for (String s : testVmOpts) {
74+
if (s.equals("-esa")) {
75+
System.out.println("Incompatible option: " + s + " specified. Skipping test.");
76+
return true;
77+
}
78+
}
79+
return false;
80+
}
81+
6782
public static void main(String[] args) throws Throwable {
83+
if (hasIncompatibleTestOptions()) {
84+
return;
85+
}
86+
6887
for (int i = 0; i < subTests.length; ++i) {
6988
int attempts = subTests[i].attempts();
7089
if (attempts == 0) {

test/jdk/jdk/jfr/jvm/TestDumpOnCrash.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,26 @@ public static void main(String[] args) throws Exception {
7474
}
7575
}
7676

77+
/*
78+
* We don't run if -esa is specified, because parser invariants are not
79+
* guaranteed for emergency dumps, which are provided on a best-effort basis only.
80+
*/
81+
private static boolean hasIncompatibleTestOptions() {
82+
String testVmOpts[] = System.getProperty("test.vm.opts","").split("\\s+");
83+
for (String s : testVmOpts) {
84+
if (s.equals("-esa")) {
85+
System.out.println("Incompatible option: " + s + " specified. Skipping test.");
86+
return true;
87+
}
88+
}
89+
return false;
90+
}
91+
7792
public static void main(String[] args) throws Exception {
93+
if (hasIncompatibleTestOptions()) {
94+
return;
95+
}
96+
7897
// Test without dumppath
7998
test(CrasherIllegalAccess.class, "", true, null, true);
8099
test(CrasherIllegalAccess.class, "", false, null, true);

0 commit comments

Comments
 (0)