Skip to content

Commit

Permalink
8208705: [TESTBUG] The -Xlog:cds,cds+hashtables vm option is not alwa…
Browse files Browse the repository at this point in the history
…ys required for appcds tests

Only include the CDS logging option in the tests which require it

Backport-of: 5858a50
  • Loading branch information
Amos Shi authored and GoeLin committed Dec 4, 2023
1 parent ae6b8d0 commit ca2290b
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 14 deletions.
8 changes: 5 additions & 3 deletions 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
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion test/hotspot/jtreg/runtime/appcds/TestCommon.java
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions test/hotspot/jtreg/runtime/appcds/VerifierTest.java
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
@@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Expand Up @@ -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");
Expand Down
Expand Up @@ -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");

Expand Down
Expand Up @@ -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)
Expand Down
Expand Up @@ -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,
Expand Down
Expand Up @@ -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");
Expand Down
Expand Up @@ -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");
Expand Down
Expand Up @@ -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");
}
Expand Down
Expand Up @@ -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");
}
Expand Down

1 comment on commit ca2290b

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.