8279970: two AppCDS tests fail after JDK-8261455

Reviewed-by: ccheung, iklam
This commit is contained in:
Yumin Qi 2022-01-19 03:21:19 +00:00
parent 4eb4f94db0
commit b0496b0df6
4 changed files with 14 additions and 6 deletions

@ -103,8 +103,6 @@ runtime/os/TestTracePageSizes.java#G1 8267460 linux-aarch64
runtime/os/TestTracePageSizes.java#Parallel 8267460 linux-aarch64
runtime/os/TestTracePageSizes.java#Serial 8267460 linux-aarch64
runtime/ErrorHandling/CreateCoredumpOnCrash.java 8267433 macosx-x64
runtime/cds/appcds/dynamicArchive/TestAutoCreateSharedArchive.java 8279970 generic-all
runtime/cds/appcds/loaderConstraints/DynamicLoaderConstraintsTest.java#custom-cl-zgc 8279970 generic-all
applications/jcstress/copy.java 8229852 linux-all

@ -38,6 +38,7 @@ class DynamicArchiveTestBase {
private static boolean executedIn_run = false;
private static boolean autoMode = false; // -Xshare:auto
private static final WhiteBox WB = WhiteBox.getWhiteBox();
private static String[] baseArchiveOptions = new String[] {};
public static interface DynamicArchiveTest {
public void run() throws Exception;
@ -95,6 +96,10 @@ class DynamicArchiveTestBase {
return TestCommon.getNewArchiveName(stem);
}
public static void setBaseArchiveOptions(String... opts) {
baseArchiveOptions = opts;
}
/**
* Excute a JVM to dump a base archive by
* -Xshare:dump -XX:SharedArchiveFile=baseArchiveName
@ -286,7 +291,7 @@ class DynamicArchiveTestBase {
private static String getTempBaseArchive() throws Exception {
if (tempBaseArchive == null) {
tempBaseArchive = getNewArchiveName("tempBaseArchive");
TestCommon.dumpBaseArchive(tempBaseArchive);
TestCommon.dumpBaseArchive(tempBaseArchive, baseArchiveOptions);
}
return tempBaseArchive;
}

@ -101,7 +101,6 @@
import java.io.IOException;
import java.io.File;
import java.nio.file.attribute.FileTime;
import java.nio.file.Files;
import java.nio.file.Paths;
@ -111,6 +110,8 @@ import jdk.test.lib.cds.CDSArchiveUtils;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.helpers.ClassFileInstaller;
import jtreg.SkippedException;
public class TestAutoCreateSharedArchive extends DynamicArchiveTestBase {
private static final String BASE_NAME = CDSTestUtils.getOutputFileName("base.jsa");
private static final String TOP_NAME = CDSTestUtils.getOutputFileName("top.jsa");
@ -123,6 +124,9 @@ public class TestAutoCreateSharedArchive extends DynamicArchiveTestBase {
private static int currentCDSVersion = CDSArchiveUtils.getCurrentCDSArchiveVersion();
public static void main(String[] args) throws Exception {
if (isUseSharedSpacesDisabled()) {
throw new SkippedException("Skipped -- This test is not applicable when JTREG tests are executed with -Xshare:off, or if the JDK doesn't have a default archive.");
}
if (args.length != 1 || (!args[0].equals("verifySharedSpacesOff") && !args[0].equals("verifySharedSpacesOn"))) {
throw new RuntimeException("Must run with verifySharedSpacesOff or verifySharedSpacesOn");
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, 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
@ -130,7 +130,7 @@ public class DynamicLoaderConstraintsTest extends DynamicArchiveTestBase {
static void doTest(boolean errorInDump) throws Exception {
for (int i = 1; i <= 3; i++) {
System.out.println("========================================");
System.out.println("errorInDump: " + errorInDump + ", useCustomLoader: " + useCustomLoader + ", case: " + i);
System.out.println("errorInDump: " + errorInDump + ", useCustomLoader: " + useCustomLoader + ", useZGC: " + useZGC + ", case: " + i);
System.out.println("========================================");
String topArchiveName = getNewArchiveName();
String testCase = Integer.toString(i);
@ -148,6 +148,7 @@ public class DynamicLoaderConstraintsTest extends DynamicArchiveTestBase {
cmdLine = TestCommon.concat(cmdLine, "-cp", loaderJar,
"-XX:+UseZGC", "-XX:ZCollectionInterval=0.01",
loaderMainClass, appJar);
setBaseArchiveOptions("-XX:+UseZGC", "-Xlog:cds");
} else {
cmdLine = TestCommon.concat(cmdLine, "-cp", loaderJar,
loaderMainClass, appJar);