test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
open Cdiff test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java
test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java
Print this page
*** 25,40 ****
--- 25,42 ----
/*
* @test
* @summary Handling of directories in -cp is based on the classlist
* @requires vm.cds
* @library /test/lib
+ * @compile test-classes/Hello.java
* @run main DirClasspathTest
*/
import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
import java.io.File;
+ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
public class DirClasspathTest {
*** 85,100 ****
/////////////////////////////////////////////////////////////////
// The classlist contains non-boot class in following test cases
/////////////////////////////////////////////////////////////////
String appClassList[] = {"java/lang/Object", "com/sun/tools/javac/Main"};
! // Non-empty dir in -cp: should report error
output = TestCommon.dump(dir.getPath(), appClassList, "-Xlog:class+path=info");
output.shouldNotHaveExitValue(0);
output.shouldContain("Cannot have non-empty directory in paths");
! // Long path to non-empty dir in -cp: should report error
! output = TestCommon.dump(longDir.getPath(), appClassList, "-Xlog:class+path=info");
output.shouldNotHaveExitValue(0);
output.shouldContain("Cannot have non-empty directory in paths");
}
}
--- 87,117 ----
/////////////////////////////////////////////////////////////////
// The classlist contains non-boot class in following test cases
/////////////////////////////////////////////////////////////////
String appClassList[] = {"java/lang/Object", "com/sun/tools/javac/Main"};
! // Non-empty dir in -cp: should be OK (as long as no classes were loaded from there)
output = TestCommon.dump(dir.getPath(), appClassList, "-Xlog:class+path=info");
+ TestCommon.checkDump(output);
+
+ // Long path to non-empty dir in -cp: should be OK (as long as no classes were loaded from there)
+ output = TestCommon.dump(longDir.getPath(), appClassList, "-Xlog:class+path=info");
+ TestCommon.checkDump(output);
+
+ /////////////////////////////////////////////////////////////////
+ // Loading an app class from a directory
+ /////////////////////////////////////////////////////////////////
+ String appClassList2[] = {"Hello", "java/lang/Object", "com/sun/tools/javac/Main"};
+ // Non-empty dir in -cp: should report error if a class is loaded from it
+ output = TestCommon.dump(classDir.toString(), appClassList2, "-Xlog:class+path=info");
output.shouldNotHaveExitValue(0);
output.shouldContain("Cannot have non-empty directory in paths");
! // Long path to non-empty dir in -cp: should report error if a class is loaded from it
! File srcClass = new File(classDir.toFile(), "Hello.class");
! File destClass = new File(longDir, "Hello.class");
! Files.copy(srcClass.toPath(), destClass.toPath());
! output = TestCommon.dump(longDir.getPath(), appClassList2, "-Xlog:class+path=info");
output.shouldNotHaveExitValue(0);
output.shouldContain("Cannot have non-empty directory in paths");
}
}
test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File