< prev index next >
test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java
Print this page
rev 53171 : 8158646: [jittester] generated tests may not compile by javac
Reviewed-by: duke
@@ -40,29 +40,34 @@
private static final int DEFAULT_JTREG_TIMEOUT = 120;
protected static final String JAVA_BIN = getJavaPath();
protected static final String JAVAC = Paths.get(JAVA_BIN, "javac").toString();
protected static final String JAVA = Paths.get(JAVA_BIN, "java").toString();
protected final Path generatorDir;
+ protected final Path tmpDir;
protected final Function<String, String[]> preRunActions;
protected final String jtDriverOptions;
private static final String DISABLE_WARNINGS = "-XX:-PrintWarnings";
protected TestsGenerator(String suffix) {
this(suffix, s -> new String[0], "");
}
protected TestsGenerator(String suffix, Function<String, String[]> preRunActions,
String jtDriverOptions) {
- generatorDir = getRoot().resolve(suffix);
+ generatorDir = getRoot().resolve(suffix).toAbsolutePath();
+ try {
+ tmpDir = Files.createTempDirectory(suffix).toAbsolutePath();
+ } catch (IOException e) {
+ throw new Error("Can't get a tmp dir for " + suffix, e);
+ }
this.preRunActions = preRunActions;
this.jtDriverOptions = jtDriverOptions;
}
protected void generateGoldenOut(String mainClassName) {
- String classPath = getRoot().resolve(generatorDir)
- .toAbsolutePath()
- .toString();
+ String classPath = tmpDir.toString() + File.pathSeparator
+ + generatorDir.toString();
ProcessBuilder pb = new ProcessBuilder(JAVA, "-Xint", DISABLE_WARNINGS, "-Xverify",
"-cp", classPath, mainClassName);
String goldFile = mainClassName + ".gold";
try {
runProcess(pb, generatorDir.resolve(goldFile).toString());
@@ -87,13 +92,14 @@
process.destroyForcibly();
}
return -1;
}
- protected static void compilePrinter() {
+ protected void compilePrinter() {
Path root = getRoot();
ProcessBuilder pbPrinter = new ProcessBuilder(JAVAC,
+ "-d", tmpDir.toString(),
root.resolve("jdk")
.resolve("test")
.resolve("lib")
.resolve("jittester")
.resolve("jtreg")
< prev index next >