< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/jigsaw/module/ModuleOption.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.
--- 1,7 ---
  /*
!  * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

*** 38,10 ***
--- 38,11 ---
          final String moduleOption = "jdk.httpserver/sun.net.httpserver.simpleserver.Main";
          final String incubatorModule = "jdk.incubator.vector";
          final String loggingOption = "-Xlog:cds=debug,cds+module=debug,cds+heap=info,module=trace";
          final String versionPattern = "java.[0-9][0-9][-].*";
          final String subgraphCannotBeUsed = "subgraph jdk.internal.module.ArchivedBootLayer cannot be used because full module graph is disabled";
+         final String noOptimizedModuleHandling = "optimized module handling: disabled because archive was created without optimized module handling";
          String archiveName = TestCommon.getNewArchiveName("module-option");
          TestCommon.setCurrentArchiveName(archiveName);
  
          // dump a base archive with -m jdk.httpserver
          OutputAnalyzer oa = TestCommon.dumpBaseArchive(

*** 56,29 ***
              loggingOption,
              "-m", moduleOption,
              "-version");
          oa.shouldHaveExitValue(0)
            // version of the jdk.httpserver module, e.g. java 22-ea
!           .shouldMatch(versionPattern)
!           .shouldMatch("cds,module.*Restored from archive: entry.0x.*name jdk.httpserver");
  
          // different module specified during runtime
          oa = TestCommon.execCommon(
              loggingOption,
              "-m", "jdk.compiler/com.sun.tools.javac.Main",
              "-version");
          oa.shouldHaveExitValue(0)
!           .shouldContain("Mismatched modules: runtime jdk.compiler dump time jdk.httpserver")
!           .shouldContain(subgraphCannotBeUsed);
  
          // no module specified during runtime
          oa = TestCommon.execCommon(
              loggingOption,
              "-version");
          oa.shouldHaveExitValue(0)
!           .shouldContain("Module jdk.httpserver specified during dump time but not during runtime")
!           .shouldContain(subgraphCannotBeUsed);
  
          // dump an archive without the module option
          archiveName = TestCommon.getNewArchiveName("no-module-option");
          TestCommon.setCurrentArchiveName(archiveName);
          oa = TestCommon.dumpBaseArchive(
--- 57,35 ---
              loggingOption,
              "-m", moduleOption,
              "-version");
          oa.shouldHaveExitValue(0)
            // version of the jdk.httpserver module, e.g. java 22-ea
!           .shouldMatch(versionPattern);
!         if (!oa.contains(noOptimizedModuleHandling)) {
+             oa.shouldMatch("cds,module.*Restored from archive: entry.0x.*name jdk.httpserver");
+         }
  
          // different module specified during runtime
          oa = TestCommon.execCommon(
              loggingOption,
              "-m", "jdk.compiler/com.sun.tools.javac.Main",
              "-version");
          oa.shouldHaveExitValue(0)
!           .shouldContain("Mismatched modules: runtime jdk.compiler dump time jdk.httpserver");
!         if (!oa.contains(noOptimizedModuleHandling)) {
+             oa.shouldContain(subgraphCannotBeUsed);
+         }
  
          // no module specified during runtime
          oa = TestCommon.execCommon(
              loggingOption,
              "-version");
          oa.shouldHaveExitValue(0)
!           .shouldContain("Module jdk.httpserver specified during dump time but not during runtime");
!         if (!oa.contains(noOptimizedModuleHandling)) {
+             oa.shouldContain(subgraphCannotBeUsed);
+         }
  
          // dump an archive without the module option
          archiveName = TestCommon.getNewArchiveName("no-module-option");
          TestCommon.setCurrentArchiveName(archiveName);
          oa = TestCommon.dumpBaseArchive(

*** 93,12 ***
              "-m", moduleOption,
              "-version");
          oa.shouldHaveExitValue(0)
            .shouldContain("Module jdk.httpserver specified during runtime but not during dump time")
            // version of the jdk.httpserver module, e.g. java 22-ea
!           .shouldMatch(versionPattern)
!           .shouldContain(subgraphCannotBeUsed);
  
          // dump an archive with an incubator module, -m jdk.incubator.vector
          archiveName = TestCommon.getNewArchiveName("incubator-module");
          TestCommon.setCurrentArchiveName(archiveName);
          oa = TestCommon.dumpBaseArchive(
--- 100,14 ---
              "-m", moduleOption,
              "-version");
          oa.shouldHaveExitValue(0)
            .shouldContain("Module jdk.httpserver specified during runtime but not during dump time")
            // version of the jdk.httpserver module, e.g. java 22-ea
!           .shouldMatch(versionPattern);
!         if (!oa.contains(noOptimizedModuleHandling)) {
+             oa.shouldContain(subgraphCannotBeUsed);
+         }
  
          // dump an archive with an incubator module, -m jdk.incubator.vector
          archiveName = TestCommon.getNewArchiveName("incubator-module");
          TestCommon.setCurrentArchiveName(archiveName);
          oa = TestCommon.dumpBaseArchive(
< prev index next >