test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods

test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java

Print this page


   1 /*
   2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 133     // --limit-modules jdk.dynalink,jdk.compiler
 134     // It seems we can't exclude the java.base module. For this case,
 135     // although the java.base module isn't in --limit-modules, the class
 136     // in the java.base module (java.net.HttpCookie) can also be found.
 137     //
 138     // --limit-modules java.base,jdk.dynalink
 139     // --limit-modules java.base,jdk.compiler
 140     public void runTestLimitMods() throws Exception {
 141         String limitMods = null;
 142         for (int excludeModIdx = 0; excludeModIdx < 3; excludeModIdx++) {
 143             for (int includeModIdx = 0; includeModIdx < 3; includeModIdx++) {
 144                 if (includeModIdx != excludeModIdx) {
 145                     if (limitMods != null) {
 146                         limitMods += ",";
 147                         limitMods += LIMIT_MODULES[includeModIdx];
 148                     } else {
 149                         limitMods = LIMIT_MODULES[includeModIdx];
 150                     }
 151                 }
 152             }
 153             output = TestCommon.exec(
 154                 appJar + File.pathSeparator + helperJar,
 155                 "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", bootClassPath,
 156                 "--limit-modules", limitMods,
 157                 "LimitModsHelper",
 158                 BOOT_ARCHIVE_CLASS, PLATFORM_ARCHIVE_CLASS, APP_ARCHIVE_CLASS,
 159                 Integer.toString(excludeModIdx)); // last 4 args passed to test
 160             TestCommon.checkExec(output);


 161             limitMods = null;
 162         }
 163     }
 164 }
   1 /*
   2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 133     // --limit-modules jdk.dynalink,jdk.compiler
 134     // It seems we can't exclude the java.base module. For this case,
 135     // although the java.base module isn't in --limit-modules, the class
 136     // in the java.base module (java.net.HttpCookie) can also be found.
 137     //
 138     // --limit-modules java.base,jdk.dynalink
 139     // --limit-modules java.base,jdk.compiler
 140     public void runTestLimitMods() throws Exception {
 141         String limitMods = null;
 142         for (int excludeModIdx = 0; excludeModIdx < 3; excludeModIdx++) {
 143             for (int includeModIdx = 0; includeModIdx < 3; includeModIdx++) {
 144                 if (includeModIdx != excludeModIdx) {
 145                     if (limitMods != null) {
 146                         limitMods += ",";
 147                         limitMods += LIMIT_MODULES[includeModIdx];
 148                     } else {
 149                         limitMods = LIMIT_MODULES[includeModIdx];
 150                     }
 151                 }
 152             }
 153             TestCommon.run(
 154                 "-cp", appJar + File.pathSeparator + helperJar,
 155                 "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", bootClassPath,
 156                 "--limit-modules", limitMods,
 157                 "LimitModsHelper",
 158                 BOOT_ARCHIVE_CLASS, PLATFORM_ARCHIVE_CLASS, APP_ARCHIVE_CLASS,
 159                 Integer.toString(excludeModIdx)) // last 4 args passed to test
 160                 .assertSilentlyDisabledCDS(out -> {
 161                     out.shouldHaveExitValue(0);
 162                 });
 163             limitMods = null;
 164         }
 165     }
 166 }
test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File