8168343: 3 javac tests fail when run on an exploded image

Reviewed-by: darcy
This commit is contained in:
Jonathan Gibbons 2016-10-20 16:31:42 -07:00
parent a60ef42892
commit 734e231c93
3 changed files with 29 additions and 5 deletions

View file

@ -21,8 +21,11 @@
* questions.
*/
import javax.tools.ToolProvider;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;
import javax.tools.ToolProvider;
/**
* @test
@ -36,6 +39,18 @@ import java.util.Objects;
// run in other vm to ensure the initialization code path is exercised.
public class ToolProviderTest {
public static void main(String... args) {
// The following code allows the test to be skipped when run on
// an exploded image.
// See https://bugs.openjdk.java.net/browse/JDK-8155858
Path javaHome = Paths.get(System.getProperty("java.home"));
Path image = javaHome.resolve("lib").resolve("modules");
Path modules = javaHome.resolve("modules");
if (!Files.exists(image) && Files.exists(modules)) {
System.err.println("Test running on exploded image");
System.err.println("Test skipped!");
return;
}
System.setSecurityManager(new SecurityManager());
Objects.requireNonNull(ToolProvider.getSystemDocumentationTool());