From ca2290ba265444c629d4a5016b1788715a7db657 Mon Sep 17 00:00:00 2001 From: Amos Shi Date: Mon, 4 Dec 2023 10:46:48 +0000 Subject: [PATCH] 8208705: [TESTBUG] The -Xlog:cds,cds+hashtables vm option is not always required for appcds tests Only include the CDS logging option in the tests which require it Backport-of: 5858a507f4019da61926d00f4d4ea488b7b07552 --- test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java | 8 +++++--- test/hotspot/jtreg/runtime/appcds/TestCommon.java | 1 - test/hotspot/jtreg/runtime/appcds/VerifierTest.java | 4 ++++ .../runtime/appcds/customLoader/ClassListFormatBase.java | 4 ++-- .../jtreg/runtime/appcds/sharedStrings/ExerciseGC.java | 2 +- .../jtreg/runtime/appcds/sharedStrings/FlagCombo.java | 2 +- .../runtime/appcds/sharedStrings/IncompatibleOptions.java | 1 + .../runtime/appcds/sharedStrings/InternSharedString.java | 2 +- .../jtreg/runtime/appcds/sharedStrings/LargePages.java | 5 +++-- .../runtime/appcds/sharedStrings/LockSharedStrings.java | 2 +- .../appcds/sharedStrings/SharedStringsBasicPlus.java | 2 +- .../runtime/appcds/sharedStrings/SharedStringsWbTest.java | 2 +- 12 files changed, 21 insertions(+), 14 deletions(-) diff --git a/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java b/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java index 5cc9a669e31..bf51f9ec232 100644 --- a/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java +++ b/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, 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 @@ -38,17 +38,19 @@ import jdk.test.lib.process.OutputAnalyzer; public class ExtraSymbols { + static final String CDS_LOGGING = "-Xlog:cds,cds+hashtables"; public static void main(String[] args) throws Exception { String appJar = JarBuilder.getOrCreateHelloJar(); // 1. Dump without extra symbols. - OutputAnalyzer output = TestCommon.dump(appJar, TestCommon.list("Hello")); + OutputAnalyzer output = TestCommon.dump(appJar, TestCommon.list("Hello"), + CDS_LOGGING); checkOutput(output); int numEntries1 = numOfEntries(output); // 2. Dump an archive with extra symbols. All symbols in // ExtraSymbols.symbols.txt are valid. Dumping should succeed. - output = TestCommon.dump(appJar, TestCommon.list("Hello"), + output = TestCommon.dump(appJar, TestCommon.list("Hello"), CDS_LOGGING, "-XX:SharedArchiveConfigFile=" + TestCommon.getSourceFile("ExtraSymbols.symbols.txt")); checkOutput(output); int numEntries2 = numOfEntries(output); diff --git a/test/hotspot/jtreg/runtime/appcds/TestCommon.java b/test/hotspot/jtreg/runtime/appcds/TestCommon.java index 57531725840..4c47b92dc1e 100644 --- a/test/hotspot/jtreg/runtime/appcds/TestCommon.java +++ b/test/hotspot/jtreg/runtime/appcds/TestCommon.java @@ -137,7 +137,6 @@ public static OutputAnalyzer createArchive(AppCDSOptions opts) } cmd.add("-Xshare:dump"); - cmd.add("-Xlog:cds,cds+hashtables"); cmd.add("-XX:ExtraSharedClassListFile=" + classList.getPath()); if (opts.archiveName == null) diff --git a/test/hotspot/jtreg/runtime/appcds/VerifierTest.java b/test/hotspot/jtreg/runtime/appcds/VerifierTest.java index f9a07234cd7..a915e42efc6 100644 --- a/test/hotspot/jtreg/runtime/appcds/VerifierTest.java +++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest.java @@ -48,6 +48,7 @@ public class VerifierTest implements Opcodes { static final String PASS_RESULT = "Hi, how are you?"; static final String VFY_INFO_MESSAGE = "All non-system classes will be verified (-Xverify:remote) during CDS dump time."; + static final String CDS_LOGGING = "-Xlog:cds,cds+hashtables"; enum Testset1Part { A, B @@ -104,6 +105,7 @@ static void testset_0(String jar, String[] noAppClasses, String[] appClasses) th // Dumping should fail if the IgnoreUnverifiableClassesDuringDump // option is not enabled. OutputAnalyzer output = TestCommon.dump(jar, appClasses, + CDS_LOGGING, "-XX:+UnlockDiagnosticVMOptions", "-XX:-IgnoreUnverifiableClassesDuringDump"); output.shouldContain("Please remove the unverifiable classes"); @@ -186,6 +188,7 @@ static void testset_1(String jar, String[] noAppClasses, String[] appClasses, Te if (!dump_setting.equals(prev_dump_setting)) { OutputAnalyzer dumpOutput = TestCommon.dump( jar, dump_list, dump_setting, + CDS_LOGGING, // FIXME: the following options are for working around a GC // issue - assert failure when dumping archive with the -Xverify:all "-Xms256m", @@ -243,6 +246,7 @@ static void testset_2(String jarName_greet, String jarName_hi) throws Exception if (!dump_setting.equals(prev_dump_setting)) { OutputAnalyzer dumpOutput = TestCommon.dump( jar, appClasses, dump_setting, + CDS_LOGGING, // FIXME: the following options are for working around a GC // issue - assert failure when dumping archive with the -Xverify:all "-Xms256m", diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatBase.java b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatBase.java index 7b1301c0137..696ea08c675 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatBase.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, 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 @@ -63,7 +63,7 @@ static void dumpShouldPass(String caseHelp, String appJar, String[] appClasses, System.out.println("------------------------------"); try { - OutputAnalyzer output = TestCommon.dump(appJar, appClasses); + OutputAnalyzer output = TestCommon.dump(appJar, appClasses, "-Xlog:cds"); output.shouldHaveExitValue(0); output.shouldContain("Dumping"); for (String s : expected_msgs) { diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java index 3e3a622c91e..7c887f7b411 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java @@ -41,7 +41,7 @@ public static void main(String[] args) throws Exception { SharedStringsUtils.buildJarAndWhiteBox("HelloStringGC"); SharedStringsUtils.dumpWithWhiteBox(TestCommon.list("HelloStringGC"), - "SharedStringsBasic.txt"); + "SharedStringsBasic.txt", "-Xlog:cds,cds+hashtables"); SharedStringsUtils.runWithArchiveAndWhiteBox("HelloStringGC", "-XX:+UnlockDiagnosticVMOptions", "-XX:+VerifyBeforeGC"); diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java index af49e221517..55c67b2411f 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java @@ -55,7 +55,7 @@ public static void main(String[] args) throws Exception { SharedStringsUtils.buildJar("HelloString"); SharedStringsUtils.dump(TestCommon.list("HelloString"), - "SharedStringsBasic.txt"); + "SharedStringsBasic.txt", "-Xlog:cds,cds+hashtables"); SharedStringsUtils.runWithArchive("HelloString", "-XX:+UseG1GC"); diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java index 633a6b80be1..77d86fc2689 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java @@ -120,6 +120,7 @@ static void testDump(int testCaseNr, String collectorOption, String extraOption, "-XX:+UseCompressedOops", collectorOption, "-XX:SharedArchiveConfigFile=" + TestCommon.getSourceFile("SharedStringsBasic.txt"), + "-Xlog:cds,cds+hashtables", extraOption); if (expectedWarning != null) diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java index c945fcbebb9..f4a56eca56d 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java @@ -43,7 +43,7 @@ public static void main(String[] args) throws Exception { SharedStringsUtils.buildJarAndWhiteBox("InternStringTest"); SharedStringsUtils.dumpWithWhiteBox(TestCommon.list("InternStringTest"), - "ExtraSharedInput.txt"); + "ExtraSharedInput.txt", "-Xlog:cds,cds+hashtables"); String[] extraMatches = new String[] { InternStringTest.passed_output1, diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java index e7b9020d9a0..09f229d318e 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java @@ -36,15 +36,16 @@ * @run main/othervm -XX:-CompactStrings LargePages */ public class LargePages { + static final String CDS_LOGGING = "-Xlog:cds,cds+hashtables"; public static void main(String[] args) throws Exception { SharedStringsUtils.buildJar("HelloString"); SharedStringsUtils.dump(TestCommon.list("HelloString"), - "SharedStringsBasic.txt", "-XX:+UseLargePages"); + "SharedStringsBasic.txt", "-XX:+UseLargePages", CDS_LOGGING); SharedStringsUtils.runWithArchive("HelloString", "-XX:+UseLargePages"); SharedStringsUtils.dump(TestCommon.list("HelloString"), - "SharedStringsBasic.txt", + "SharedStringsBasic.txt", CDS_LOGGING, "-XX:+UseLargePages", "-XX:+UseLargePagesInMetaspace"); SharedStringsUtils.runWithArchive("HelloString", "-XX:+UseLargePages", "-XX:+UseLargePagesInMetaspace"); diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java index 1ff7ff3eee1..0b581be8482 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java @@ -44,7 +44,7 @@ public static void main(String[] args) throws Exception { SharedStringsUtils.dumpWithWhiteBox( TestCommon.list("LockStringTest", "LockStringValueTest"), - "ExtraSharedInput.txt"); + "ExtraSharedInput.txt", "-Xlog:cds,cds+hashtables"); String[] extraMatch = new String[] {"LockStringTest: PASS"}; SharedStringsUtils.runWithArchiveAndWhiteBox(extraMatch, "LockStringTest"); diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java index 1264955b996..8ed4a4c05e8 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java @@ -42,7 +42,7 @@ public static void main(String[] args) throws Exception { SharedStringsUtils.buildJarAndWhiteBox("HelloStringPlus"); SharedStringsUtils.dumpWithWhiteBox( TestCommon.list("HelloStringPlus"), - "SharedStringsBasic.txt"); + "SharedStringsBasic.txt", "-Xlog:cds,cds+hashtables"); SharedStringsUtils.runWithArchiveAndWhiteBox("HelloStringPlus"); } diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java index 1b6dd55eee3..22c5fb92bcc 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java @@ -45,7 +45,7 @@ public static void main(String[] args) throws Exception { SharedStringsUtils.buildJarAndWhiteBox("SharedStringsWb"); SharedStringsUtils.dumpWithWhiteBox(TestCommon.list("SharedStringsWb"), - "SharedStringsBasic.txt"); + "SharedStringsBasic.txt", "-Xlog:cds,cds+hashtables"); SharedStringsUtils.runWithArchiveAndWhiteBox("SharedStringsWb"); }