< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompilationWrapperTest.java
Print this page
*** 120,137 ****
/**
* Tests compilation requested by Truffle.
*/
@Test
! public void testTruffleCompilation() throws IOException, InterruptedException {
testHelper(Collections.emptyList(),
Arrays.asList(
"-Dgraal.CompilationFailureAction=ExitVM",
"-Dgraal.CrashAt=root test1"),
"org.graalvm.compiler.truffle.test.SLTruffleGraalTestSuite", "test");
}
private static final boolean VERBOSE = Boolean.getBoolean(CompilationWrapperTest.class.getSimpleName() + ".verbose");
private static void testHelper(List<Probe> initialProbes, List<String> extraVmArgs, String... mainClassAndArgs) throws IOException, InterruptedException {
final File dumpPath = new File(CompilationWrapperTest.class.getSimpleName() + "_" + System.currentTimeMillis()).getAbsoluteFile();
List<String> vmArgs = withoutDebuggerArguments(getVMCommandLine());
--- 120,153 ----
/**
* Tests compilation requested by Truffle.
*/
@Test
! public void testTruffleCompilation1() throws IOException, InterruptedException {
testHelper(Collections.emptyList(),
Arrays.asList(
"-Dgraal.CompilationFailureAction=ExitVM",
"-Dgraal.CrashAt=root test1"),
"org.graalvm.compiler.truffle.test.SLTruffleGraalTestSuite", "test");
}
+ /**
+ * Tests that TruffleCompilationExceptionsAreFatal works as expected.
+ */
+ @Test
+ public void testTruffleCompilation2() throws IOException, InterruptedException {
+ Probe[] probes = {
+ new Probe("Exiting VM due to TruffleCompilationExceptionsAreFatal=true", 1),
+ };
+ testHelper(Arrays.asList(probes),
+ Arrays.asList(
+ "-Dgraal.CompilationFailureAction=Silent",
+ "-Dgraal.TruffleCompilationExceptionsAreFatal=true",
+ "-Dgraal.CrashAt=root test1"),
+ "org.graalvm.compiler.truffle.test.SLTruffleGraalTestSuite", "test");
+ }
+
private static final boolean VERBOSE = Boolean.getBoolean(CompilationWrapperTest.class.getSimpleName() + ".verbose");
private static void testHelper(List<Probe> initialProbes, List<String> extraVmArgs, String... mainClassAndArgs) throws IOException, InterruptedException {
final File dumpPath = new File(CompilationWrapperTest.class.getSimpleName() + "_" + System.currentTimeMillis()).getAbsoluteFile();
List<String> vmArgs = withoutDebuggerArguments(getVMCommandLine());
*** 147,164 ****
if (VERBOSE) {
System.out.println(proc);
}
List<Probe> probes = new ArrayList<>(initialProbes);
! Probe diagnosticProbe = new Probe("Graal diagnostic output saved in ", 1);
probes.add(diagnosticProbe);
probes.add(new Probe("Forced crash after compiling", Integer.MAX_VALUE) {
@Override
String test() {
return actualOccurrences > 0 ? null : "expected at least 1 occurrence";
}
});
for (String line : proc.output) {
for (Probe probe : probes) {
if (probe.matches(line)) {
break;
--- 163,183 ----
if (VERBOSE) {
System.out.println(proc);
}
List<Probe> probes = new ArrayList<>(initialProbes);
! Probe diagnosticProbe = null;
! if (!extraVmArgs.contains("-Dgraal.TruffleCompilationExceptionsAreFatal=true")) {
! diagnosticProbe = new Probe("Graal diagnostic output saved in ", 1);
probes.add(diagnosticProbe);
probes.add(new Probe("Forced crash after compiling", Integer.MAX_VALUE) {
@Override
String test() {
return actualOccurrences > 0 ? null : "expected at least 1 occurrence";
}
});
+ }
for (String line : proc.output) {
for (Probe probe : probes) {
if (probe.matches(line)) {
break;
*** 169,180 ****
String error = probe.test();
if (error != null) {
Assert.fail(String.format("Did not find expected occurences of '%s' in output of command: %s%n%s", probe.substring, error, proc));
}
}
!
! String diagnosticOutputZip = diagnosticProbe.lastMatchingLine.substring(diagnosticProbe.substring.length()).trim();
List<String> dumpPathEntries = Arrays.asList(dumpPath.list());
File zip = new File(diagnosticOutputZip).getAbsoluteFile();
Assert.assertTrue(zip.toString(), zip.exists());
--- 188,202 ----
String error = probe.test();
if (error != null) {
Assert.fail(String.format("Did not find expected occurences of '%s' in output of command: %s%n%s", probe.substring, error, proc));
}
}
! if (diagnosticProbe != null) {
! String line = diagnosticProbe.lastMatchingLine;
! int substringStart = line.indexOf(diagnosticProbe.substring);
! int substringLength = diagnosticProbe.substring.length();
! String diagnosticOutputZip = line.substring(substringStart + substringLength).trim();
List<String> dumpPathEntries = Arrays.asList(dumpPath.list());
File zip = new File(diagnosticOutputZip).getAbsoluteFile();
Assert.assertTrue(zip.toString(), zip.exists());
*** 203,208 ****
--- 225,231 ----
} finally {
zip.delete();
dumpPath.delete();
}
}
+ }
}
< prev index next >