< prev index next >

test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java

Print this page

        

*** 22,32 **** * */ /* * @test ! * @summary AppCDS handling of directories in -cp * @requires vm.cds * @library /test/lib * @run main DirClasspathTest */ --- 22,32 ---- * */ /* * @test ! * @summary Handling of directories in -cp is based on the classlist * @requires vm.cds * @library /test/lib * @run main DirClasspathTest */
*** 43,56 **** public static void main(String[] args) throws Exception { File dir = new File(System.getProperty("user.dir")); File emptydir = new File(dir, "emptydir"); emptydir.mkdir(); // Empty dir in -cp: should be OK OutputAnalyzer output; ! String classList[] = {"java/lang/Object"}; ! output = TestCommon.dump(emptydir.getPath(), classList, "-Xlog:class+path=info"); TestCommon.checkDump(output); // Long path to empty dir in -cp: should be OK Path classDir = Paths.get(System.getProperty("test.classes")); Path destDir = classDir; --- 43,60 ---- public static void main(String[] args) throws Exception { File dir = new File(System.getProperty("user.dir")); File emptydir = new File(dir, "emptydir"); emptydir.mkdir(); + ///////////////////////////////////////////////////////////////// + // The classlist only contains boot class in following test cases + ///////////////////////////////////////////////////////////////// + String bootClassList[] = {"java/lang/Object"}; + // Empty dir in -cp: should be OK OutputAnalyzer output; ! output = TestCommon.dump(emptydir.getPath(), bootClassList, "-Xlog:class+path=info"); TestCommon.checkDump(output); // Long path to empty dir in -cp: should be OK Path classDir = Paths.get(System.getProperty("test.classes")); Path destDir = classDir;
*** 63,83 **** } File longDir = destDir.toFile(); longDir.mkdir(); File subDir = new File(longDir, "subdir"); subDir.mkdir(); ! output = TestCommon.dump(subDir.getPath(), classList, "-Xlog:class+path=info"); TestCommon.checkDump(output); ! // Non-empty dir in -cp: should fail // <dir> is not empty because it has at least one subdirectory, i.e., <emptydir> ! output = TestCommon.dump(dir.getPath(), classList, "-Xlog:class+path=info"); ! output.shouldNotHaveExitValue(0); ! output.shouldContain("CDS allows only empty directories in archived classpaths"); ! // Long path to non-empty dir in -cp: should fail // <dir> is not empty because it has at least one subdirectory, i.e., <emptydir> ! output = TestCommon.dump(longDir.getPath(), classList, "-Xlog:class+path=info"); output.shouldNotHaveExitValue(0); ! output.shouldContain("CDS allows only empty directories in archived classpaths"); } } --- 67,100 ---- } File longDir = destDir.toFile(); longDir.mkdir(); File subDir = new File(longDir, "subdir"); subDir.mkdir(); ! output = TestCommon.dump(subDir.getPath(), bootClassList, "-Xlog:class+path=info"); TestCommon.checkDump(output); ! // Non-empty dir in -cp: should be OK // <dir> is not empty because it has at least one subdirectory, i.e., <emptydir> ! output = TestCommon.dump(dir.getPath(), bootClassList, "-Xlog:class+path=info"); ! TestCommon.checkDump(output); ! // Long path to non-empty dir in -cp: should be OK // <dir> is not empty because it has at least one subdirectory, i.e., <emptydir> ! output = TestCommon.dump(longDir.getPath(), bootClassList, "-Xlog:class+path=info"); ! TestCommon.checkDump(output); ! ! ///////////////////////////////////////////////////////////////// ! // 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"); } }
< prev index next >