mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8054474: Add --state-dir=bar to sjavac
Add --state-dir=bar to sjavac to control where sjavac stores the javac_state file. Reviewed-by: jjg, alundblad
This commit is contained in:
parent
ce6154a2fa
commit
c8256e4d27
10 changed files with 107 additions and 26 deletions
|
@ -25,7 +25,7 @@
|
|||
/*
|
||||
* @test
|
||||
* @summary Test all aspects of sjavac.
|
||||
* @bug 8004658 8042441 8042699 8054461
|
||||
* @bug 8004658 8042441 8042699 8054461 8054474
|
||||
*
|
||||
* @build Wrapper
|
||||
* @run main Wrapper SJavac
|
||||
|
@ -100,6 +100,7 @@ public class SJavac {
|
|||
compileExcludingDependency();
|
||||
incrementalCompileTestFullyQualifiedRef();
|
||||
compileWithAtFile();
|
||||
testStateDir();
|
||||
|
||||
delete(gensrc);
|
||||
delete(gensrc2);
|
||||
|
@ -495,6 +496,37 @@ public class SJavac {
|
|||
"bin/beta/B.class");
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests storing javac_state into another directory.
|
||||
* @throws Exception If test fails
|
||||
*/
|
||||
void testStateDir() throws Exception {
|
||||
System.out.println("\nVerify that --state-dir=bar works.");
|
||||
System.out.println("----------------------------------");
|
||||
|
||||
Path bar = defaultfs.getPath("bar");
|
||||
Files.createDirectory(bar);
|
||||
|
||||
delete(gensrc);
|
||||
delete(bin);
|
||||
delete(bar);
|
||||
previous_bin_state = collectState(bin);
|
||||
Map<String,Long> previous_bar_state = collectState(bar);
|
||||
|
||||
populate(gensrc,
|
||||
"alfa/omega/A.java",
|
||||
"package alfa.omega; public class A { }");
|
||||
|
||||
compile("--state-dir=bar", "-src", "gensrc", "-d", "bin", serverArg);
|
||||
|
||||
Map<String,Long> new_bin_state = collectState(bin);
|
||||
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
|
||||
"bin/alfa/omega/A.class");
|
||||
Map<String,Long> new_bar_state = collectState(bar);
|
||||
verifyThatFilesHaveBeenAdded(previous_bar_state, new_bar_state,
|
||||
"bar/javac_state");
|
||||
}
|
||||
|
||||
void removeFrom(Path dir, String... args) throws IOException {
|
||||
for (String filename : args) {
|
||||
Path p = dir.resolve(filename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue