--- old/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckArchivedModuleApp.java 2018-07-20 13:34:34.638489721 -0400 +++ new/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckArchivedModuleApp.java 2018-07-20 13:34:33.246408782 -0400 @@ -23,6 +23,7 @@ */ import java.io.File; +import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.util.Set; import sun.hotspot.WhiteBox; @@ -41,16 +42,18 @@ return; } - boolean expectArchived = "yes".equals(args[0]); - checkModuleDescriptors(expectArchived); + boolean expectArchivedDescriptors = "yes".equals(args[0]); + boolean expectArchivedConfiguration = "yes".equals(args[1]); + checkModuleDescriptors(expectArchivedDescriptors); + checkConfiguration(expectArchivedConfiguration); } - private static void checkModuleDescriptors(boolean expectArchived) { + private static void checkModuleDescriptors(boolean expectArchivedDescriptors) { Set modules = ModuleLayer.boot().modules(); for (Module m : modules) { ModuleDescriptor md = m.getDescriptor(); String name = md.name(); - if (expectArchived) { + if (expectArchivedDescriptors) { if (wb.isShared(md)) { System.out.println(name + " is archived. Expected."); } else { @@ -67,4 +70,23 @@ } } } + + private static void checkConfiguration(boolean expectArchivedConfiguration) { + Configuration cf = ModuleLayer.boot().configuration(); + if (expectArchivedConfiguration) { + if (wb.isShared(cf)) { + System.out.println("Boot layer configuration is archived. Expected."); + } else { + throw new RuntimeException( + "FAILED. Boot layer configuration is not archived."); + } + } else { + if (!wb.isShared(cf)) { + System.out.println("Boot layer configuration is not archived. Expected."); + } else { + throw new RuntimeException( + "FAILED. Boot layer configuration is archived."); + } + } + } }