-
Notifications
You must be signed in to change notification settings - Fork 252
8272552: mark hotspot runtime/cds tests which ignore external VM flags #2408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. | ||
| * Copyright (c) 2015, 2021, 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 | ||
|
|
@@ -24,11 +24,13 @@ | |
| /** | ||
| * @test | ||
| * @requires vm.cds | ||
| * @requires vm.flagless | ||
| * @bug 8067187 8200078 | ||
| * @summary Testing CDS dumping with the -XX:MaxMetaspaceSize=<size> option | ||
| * @library /test/lib | ||
| * @modules java.base/jdk.internal.misc | ||
| * java.management | ||
| * @run driver MaxMetaspaceSize | ||
| */ | ||
|
|
||
| import java.util.ArrayList; | ||
|
|
@@ -45,12 +47,11 @@ public static void main(String[] args) throws Exception { | |
| if (Platform.is64bit()) { | ||
| processArgs.add("-XX:MaxMetaspaceSize=3m"); | ||
| processArgs.add("-XX:CompressedClassSpaceSize=1m"); | ||
| processArgs.add("-XX:InitialBootClassLoaderMetaspaceSize=1m"); | ||
| } else { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8251158 (commit 7ba6a6b ) on this file |
||
| processArgs.add("-XX:MaxMetaspaceSize=1m"); | ||
| } | ||
|
|
||
| String msg = "Failed allocating metaspace object"; | ||
| String msg = "OutOfMemoryError: Metaspace"; | ||
| ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(processArgs); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8261551 (commit 41657b1 ) on this file |
||
| CDSTestUtils.executeAndLog(pb, "dump").shouldContain(msg).shouldHaveExitValue(1); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. | ||
| * Copyright (c) 2015, 2021, 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 | ||
|
|
@@ -26,17 +26,17 @@ | |
| * @summary Check to make sure that shared strings in the bootstrap CDS archive | ||
| * are actually shared | ||
| * @requires vm.cds.archived.java.heap | ||
| * @requires vm.flagless | ||
| * @library /test/lib | ||
| * @modules java.base/jdk.internal.misc | ||
| * java.management | ||
| * @build SharedStringsWb sun.hotspot.WhiteBox | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8229267 ( commit e9b271d ) on this file |
||
| * @run driver ClassFileInstaller -jar whitebox.jar sun.hotspot.WhiteBox | ||
| * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar whitebox.jar sun.hotspot.WhiteBox | ||
| * @run driver SharedStrings | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8263549 ( commit a7aba2b ) on this file |
||
| */ | ||
|
|
||
| import jdk.test.lib.cds.CDSTestUtils; | ||
| import jdk.test.lib.process.ProcessTools; | ||
| import jdk.test.lib.process.OutputAnalyzer; | ||
| import jdk.test.lib.helpers.ClassFileInstaller; | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8263412 ( commit e834f99 ) on this file |
||
| public class SharedStrings { | ||
| public static void main(String[] args) throws Exception { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. | ||
| * Copyright (c) 2018, 2021, 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 | ||
|
|
@@ -27,12 +27,10 @@ | |
| * @summary Test that CDS still works when the JDK is moved to a new directory | ||
| * @bug 8272345 | ||
| * @requires vm.cds | ||
| * @requires vm.flagless | ||
| * @comment This test doesn't work on Windows because it depends on symlinks | ||
| * @requires os.family != "windows" | ||
| * @library /test/lib | ||
| * @modules java.base/jdk.internal.misc | ||
| * java.management | ||
| * jdk.jartool/sun.tools.jar | ||
| * @compile test-classes/Hello.java | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8229267 ( commit e9b271d ) on this file |
||
| * @run driver MoveJDKTest | ||
| */ | ||
|
|
@@ -42,19 +40,21 @@ | |
| import java.nio.file.Path; | ||
| import java.nio.file.Paths; | ||
| import java.nio.file.StandardCopyOption; | ||
| import jdk.test.lib.cds.CDSTestUtils; | ||
| import jdk.test.lib.process.OutputAnalyzer; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8251213 ( commit c1093dc ) on this file |
||
|
|
||
| public class MoveJDKTest { | ||
| public static void main(String[] args) throws Exception { | ||
| String java_home_src = System.getProperty("java.home"); | ||
| String java_home_dst = System.getProperty("user.dir") + File.separator + "moved_jdk"; | ||
| String java_home_dst = CDSTestUtils.getOutputDir() + File.separator + "moved_jdk"; | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8251267 ( commit 291ba97 ) on this file |
||
| TestCommon.startNewArchiveName(); | ||
| String jsaFile = TestCommon.getCurrentArchiveName(); | ||
| String jsaOpt = "-XX:SharedArchiveFile=" + jsaFile; | ||
| { | ||
| ProcessBuilder pb = makeBuilder(java_home_src + "/bin/java", "-Xshare:dump", jsaOpt); | ||
| TestCommon.executeAndLog(pb, "dump"); | ||
| TestCommon.executeAndLog(pb, "dump") | ||
| .shouldHaveExitValue(0); | ||
| } | ||
| { | ||
| ProcessBuilder pb = makeBuilder(java_home_src + "/bin/java", | ||
|
|
@@ -63,6 +63,7 @@ public static void main(String[] args) throws Exception { | |
| "-Xlog:class+path=info", | ||
| "-version"); | ||
| OutputAnalyzer out = TestCommon.executeAndLog(pb, "exec-src"); | ||
| out.shouldHaveExitValue(0); | ||
| out.shouldNotContain("shared class paths mismatch"); | ||
| out.shouldNotContain("BOOT classpath mismatch"); | ||
| } | ||
|
|
@@ -78,6 +79,7 @@ public static void main(String[] args) throws Exception { | |
| "-Xlog:class+path=info", | ||
| "-version"); | ||
| OutputAnalyzer out = TestCommon.executeAndLog(pb, "exec-dst"); | ||
| out.shouldHaveExitValue(0); | ||
| out.shouldNotContain("shared class paths mismatch"); | ||
| out.shouldNotContain("BOOT classpath mismatch"); | ||
| } | ||
|
|
@@ -91,7 +93,8 @@ public static void main(String[] args) throws Exception { | |
| "-Xshare:dump", | ||
| dumptimeBootAppendOpt, | ||
| jsaOpt); | ||
| TestCommon.executeAndLog(pb, "dump"); | ||
| TestCommon.executeAndLog(pb, "dump") | ||
| .shouldHaveExitValue(0); | ||
| } | ||
| { | ||
| String runtimeBootAppendOpt = dumptimeBootAppendOpt + System.getProperty("path.separator") + helloJar; | ||
|
|
@@ -102,9 +105,20 @@ public static void main(String[] args) throws Exception { | |
| "-Xlog:class+path=info", | ||
| "-version"); | ||
| OutputAnalyzer out = TestCommon.executeAndLog(pb, "exec-dst"); | ||
| out.shouldHaveExitValue(0); | ||
| out.shouldNotContain("shared class paths mismatch"); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8272335 ( commit 75a0642 ) on this file |
||
| out.shouldNotContain("BOOT classpath mismatch"); | ||
| } | ||
|
|
||
| // Test with no modules image in the <java home>/lib directory | ||
| renameModulesFile(java_home_dst); | ||
| { | ||
| ProcessBuilder pb = makeBuilder(java_home_dst + "/bin/java", | ||
| "-version"); | ||
| OutputAnalyzer out = TestCommon.executeAndLog(pb, "exec-missing-modules"); | ||
| out.shouldHaveExitValue(1); | ||
| out.shouldContain("Failed setting boot class path."); | ||
| } | ||
| } | ||
|
|
||
| // Do a cheap clone of the JDK. Most files can be sym-linked. However, $JAVA_HOME/bin/java and $JAVA_HOME/lib/.../libjvm.so" | ||
|
|
@@ -142,6 +156,24 @@ static void clone(File src, File dst) throws Exception { | |
| } | ||
| } | ||
|
|
||
| static void renameModulesFile(String javaHome) throws Exception { | ||
| String modulesDir = javaHome + File.separator + "lib"; | ||
| File origModules = new File(modulesDir, "modules"); | ||
| if (!origModules.exists()) { | ||
| throw new RuntimeException("modules file not found"); | ||
| } | ||
|
|
||
| File renamedModules = new File(modulesDir, "orig_modules"); | ||
| if (renamedModules.exists()) { | ||
| throw new RuntimeException("found orig_modules unexpectedly"); | ||
| } | ||
|
|
||
| boolean success = origModules.renameTo(renamedModules); | ||
| if (!success) { | ||
| throw new RuntimeException("rename modules file failed"); | ||
| } | ||
| } | ||
|
|
||
| static ProcessBuilder makeBuilder(String... args) throws Exception { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8205946 ( commit a10d6e7 ) on this file |
||
| System.out.print("["); | ||
| for (String s : args) { | ||
|
|
@@ -152,12 +184,12 @@ static ProcessBuilder makeBuilder(String... args) throws Exception { | |
| } | ||
|
|
||
| private static String copyFakeModulesFromHelloJar() throws Exception { | ||
| String classDir = System.getProperty("test.classes"); | ||
| String outDir = CDSTestUtils.getOutputDir(); | ||
| String newFile = "hello.modules"; | ||
| String path = classDir + File.separator + newFile; | ||
| String path = outDir + File.separator + newFile; | ||
|
|
||
| Files.copy(Paths.get(classDir, "hello.jar"), | ||
| Paths.get(classDir, newFile), | ||
| Files.copy(Paths.get(outDir, "hello.jar"), | ||
| Paths.get(outDir, newFile), | ||
| StandardCopyOption.REPLACE_EXISTING); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8251213 ( commit c1093dc ) on this file |
||
| return path; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| * Copyright (c) 2021, Alibaba Group Holding Limited. 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. | ||
| * | ||
| * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| * version 2 for more details (a copy is included in the LICENSE file that | ||
| * accompanied this code). | ||
| * | ||
| * You should have received a copy of the GNU General Public License version | ||
| * 2 along with this work; if not, write to the Free Software Foundation, | ||
| * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| * | ||
| * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| * or visit www.oracle.com if you need additional information or have any | ||
| * questions. | ||
| * | ||
| */ | ||
|
|
||
| /* | ||
| * @test | ||
| * @bug 8264337 | ||
| * @summary test default cds archive when turning on VerifySharedSpaces | ||
| * @requires vm.flagless | ||
| * @requires vm.cds | ||
| * @library /test/lib | ||
| * @run driver VerifyWithDefaultArchive | ||
| */ | ||
|
|
||
| import jdk.test.lib.process.ProcessTools; | ||
| import jdk.test.lib.process.OutputAnalyzer; | ||
|
|
||
| public class VerifyWithDefaultArchive { | ||
| public static void main(String... args) throws Exception { | ||
| ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:cds", "-XX:+VerifySharedSpaces", "-version"); | ||
| OutputAnalyzer out = new OutputAnalyzer(pb.start()); | ||
| out.shouldNotContain("relocation bitmap CRC error"); | ||
| out.shouldHaveExitValue(0); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /** | ||
| * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. | ||
| /* | ||
| * Copyright (c) 2018, 2021, 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 | ||
|
|
@@ -25,15 +25,12 @@ | |
| * @test | ||
| * @summary Test archived module graph with custom runtime image | ||
| * @requires vm.cds.archived.java.heap | ||
| * @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/appcds | ||
| * @modules java.base/jdk.internal.module | ||
| * java.management | ||
| * jdk.jlink | ||
| * jdk.compiler | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8229267 ( commit e9b271d ) on this file |
||
| * @requires vm.flagless | ||
| * @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/cds/appcds | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8202339 ( commit 1ed3649 ) on this file |
||
| * @build sun.hotspot.WhiteBox | ||
| * @compile CheckArchivedModuleApp.java | ||
| * @run driver ClassFileInstaller -jar app.jar CheckArchivedModuleApp | ||
| * @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox | ||
| * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar app.jar CheckArchivedModuleApp | ||
| * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8263549 ( commit a7aba2b ) on this file |
||
| * @run driver ArchivedModuleWithCustomImageTest | ||
| */ | ||
|
|
||
|
|
@@ -45,6 +42,7 @@ | |
| import jdk.test.lib.compiler.CompilerUtils; | ||
| import jdk.test.lib.process.OutputAnalyzer; | ||
| import jdk.test.lib.process.ProcessTools; | ||
| import jdk.test.lib.helpers.ClassFileInstaller; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8263412 ( commit e834f99 ) on this file |
||
|
|
||
| public class ArchivedModuleWithCustomImageTest { | ||
| private static final String JAVA_HOME = System.getProperty("java.home"); | ||
|
|
@@ -110,7 +108,7 @@ private static void testArchivedModuleUsingImage(Path image) | |
| String[] dumpCmd = { | ||
| customJava.toString(), | ||
| "-XX:SharedArchiveFile=./ArchivedModuleWithCustomImageTest.jsa", | ||
| "-Xshare:dump"}; | ||
| "-Xshare:dump", "-Xlog:cds"}; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Includes the changes from JDK-8233826 ( commit d1ad0ea ) on this file |
||
| printCommand(dumpCmd); | ||
| ProcessBuilder pbDump = new ProcessBuilder(); | ||
| pbDump.command(dumpCmd); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Includes the changes from JDK-8243945 ( commit 46fe7e3 ) on this file