mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8168343: 3 javac tests fail when run on an exploded image
Reviewed-by: darcy
This commit is contained in:
parent
a60ef42892
commit
734e231c93
3 changed files with 29 additions and 5 deletions
|
@ -109,9 +109,15 @@ CheckFiles BadZip/Lib.zip BadJar/Lib.jar BadSrc/Lib.java
|
||||||
echo 'public class Main {public static void main(String[] a) {Lib.f();}}' > Main.java
|
echo 'public class Main {public static void main(String[] a) {Lib.f();}}' > Main.java
|
||||||
|
|
||||||
# Create a jar file that is good enough to put on the javac boot class path (i.e. contains java.lang.**)
|
# Create a jar file that is good enough to put on the javac boot class path (i.e. contains java.lang.**)
|
||||||
Sys "$jimage" extract --dir modules ${TESTJAVA}/lib/modules
|
if [ -r ${TESTJAVA}/lib/modules ]; then
|
||||||
Sys "$jar" cf java-lang.jar -C modules/java.base java/lang
|
Sys "$jimage" extract --dir modules ${TESTJAVA}/lib/modules
|
||||||
Sys rm -rf modules
|
Sys "$jar" cf java-lang.jar -C modules/java.base java/lang
|
||||||
|
Sys rm -rf modules
|
||||||
|
elif [ -d ${TESTJAVA}/modules ]; then
|
||||||
|
Sys "$jar" cf java-lang.jar -C ${TESTJAVA}/modules/java.base java/lang
|
||||||
|
else
|
||||||
|
echo 'cannot create java-lang.jar' ; exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
#----------------------------------------------------------------
|
#----------------------------------------------------------------
|
||||||
# Verify that javac class search order is the same as java's
|
# Verify that javac class search order is the same as java's
|
||||||
|
|
|
@ -21,8 +21,11 @@
|
||||||
* questions.
|
* 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 java.util.Objects;
|
||||||
|
import javax.tools.ToolProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
|
@ -36,6 +39,18 @@ import java.util.Objects;
|
||||||
// run in other vm to ensure the initialization code path is exercised.
|
// run in other vm to ensure the initialization code path is exercised.
|
||||||
public class ToolProviderTest {
|
public class ToolProviderTest {
|
||||||
public static void main(String... args) {
|
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());
|
System.setSecurityManager(new SecurityManager());
|
||||||
|
|
||||||
Objects.requireNonNull(ToolProvider.getSystemDocumentationTool());
|
Objects.requireNonNull(ToolProvider.getSystemDocumentationTool());
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
@ -84,7 +85,9 @@ public class Main {
|
||||||
continue;
|
continue;
|
||||||
if (type.endsWith("module-info"))
|
if (type.endsWith("module-info"))
|
||||||
continue;
|
continue;
|
||||||
String moduleName = fm.asPath(file).getName(1).toString();
|
Path path = fm.asPath(file);
|
||||||
|
int moduleIndex = path.getNameCount() - type.split("\\Q.\\E").length - 1;
|
||||||
|
String moduleName = path.getName(moduleIndex).toString();
|
||||||
try {
|
try {
|
||||||
ModuleElement me = elements.getModuleElement(moduleName);
|
ModuleElement me = elements.getModuleElement(moduleName);
|
||||||
me.getClass();
|
me.getClass();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue