src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompilationWrapperTest.java
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompilationWrapperTest.java Thu Jul 25 11:44:37 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompilationWrapperTest.java Thu Jul 25 17:35:58 2019 -0400
@@ -29,6 +29,7 @@
import java.io.File;
import java.io.IOException;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -209,10 +210,9 @@
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);
+ try {
+ 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
@@ -220,22 +220,20 @@
return actualOccurrences > 0 ? null : "expected at least 1 occurrence";
}
});
- }
- for (String line : proc.output) {
- for (Probe probe : probes) {
- if (probe.matches(line)) {
- break;
+ for (String line : proc.output) {
+ for (Probe probe : probes) {
+ if (probe.matches(line)) {
+ break;
+ }
}
}
- }
- for (Probe probe : probes) {
- 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));
+ for (Probe probe : probes) {
+ 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();
@@ -263,8 +261,10 @@
}
} finally {
zip.delete();
- dumpPath.delete();
}
+ } finally {
+ Path directory = dumpPath.toPath();
+ removeDirectory(directory);
}
}
}