< prev index next >

test/tools/jmod/JmodTest.java

Print this page

        

*** 21,31 **** * questions. */ /* * @test ! * @bug 8142968 8166568 * @summary Basic test for jmod * @library /lib/testlibrary * @modules jdk.compiler * jdk.jlink * @build jdk.testlibrary.FileUtils CompilerUtils --- 21,31 ---- * questions. */ /* * @test ! * @bug 8142968 8166568 8166286 8170618 * @summary Basic test for jmod * @library /lib/testlibrary * @modules jdk.compiler * jdk.jlink * @build jdk.testlibrary.FileUtils CompilerUtils
*** 112,121 **** --- 112,142 ---- "--class-path", classesDir.toString(), jmod.toString()) .assertSuccess(); } + // JDK-8170618 - jmod should validate if any exported or open package is missing + @Test + public void testMissingPackages() throws IOException { + Path apaDir = EXPLODED_DIR.resolve("apa"); + Path classesDir = EXPLODED_DIR.resolve("apa").resolve("classes"); + if (Files.exists(classesDir)) + FileUtils.deleteFileTreeWithRetry(classesDir); + assertTrue(compileModule("apa", classesDir)); + FileUtils.deleteFileTreeWithRetry(classesDir.resolve("jdk")); + Path jmod = MODS_DIR.resolve("apa.jmod"); + jmod("create", + "--class-path", classesDir.toString(), + jmod.toString()) + .assertFailure() + .resultChecker(r -> { + assertContains(r.output, "Packages that are exported or open in apa are not present: [jdk.test.apa]"); + }); + if (Files.exists(classesDir)) + FileUtils.deleteFileTreeWithRetry(classesDir); + } + @Test public void testList() throws IOException { String cp = EXPLODED_DIR.resolve("foo").resolve("classes").toString(); jmod("create", "--class-path", cp,
< prev index next >