8258732: runtime/cds/appcds/dynamicArchive/DynamicArchiveRelocationTest.java fails

Reviewed-by: minqi, iklam
This commit is contained in:
Calvin Cheung 2021-02-05 17:23:48 +00:00
parent f9df366255
commit 0218917109

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 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
@ -91,8 +91,12 @@ public class DynamicArchiveRelocationTest extends DynamicArchiveTestBase {
String topArchiveName = getNewArchiveName("top");
String runtimeMsg = "Try to map archive(s) at an alternative address";
String runtimeRelocMsg = "runtime archive relocation start";
String unmapPrefix = ".*Unmapping region #3 at base 0x.*";
String unmapPattern = unmapPrefix + "(Bitmap)";
String archiveRelocPattern = ".*ArchiveRelocationMode == 1.*";
String unmapRgn1Pattern = ".*Unmapping region #1 at base 0x.*";
String unmapRgn0Pattern = ".*Unmapping region #0 at base 0x.*(MiscCode)";
String unlockArg = "-XX:+UnlockDiagnosticVMOptions";
// (1) Dump base archive (static)
@ -123,12 +127,21 @@ public class DynamicArchiveRelocationTest extends DynamicArchiveTestBase {
"-cp", appJar, mainClass)
.assertNormalExit(output -> {
if (run_reloc) {
output.shouldContain(runtimeMsg)
// Check that there are two of the following lines in
// the output. One for static archive and one for
// dynamic archive:
// Unmapping region #3 at base 0x<hex digits> (Bitmap)
.shouldMatchByLine(unmapPrefix, "Hello World", unmapPattern);
output.shouldContain(runtimeMsg);
try {
output.shouldContain(runtimeRelocMsg)
// Check that there are two of the following lines in
// the output. One for static archive and one for
// dynamic archive:
// Unmapping region #3 at base 0x<hex digits> (Bitmap)
.shouldMatchByLine(unmapPrefix, "Hello World", unmapPattern);
} catch(java.lang.RuntimeException ex) {
// On Windows, sometimes the OS picks the same archive
// base address even with ArchiveRelcationMode=1. In
// this case, runtime relocation won't happen. Checking
// for "Unmapping region #0" messages instead.
output.shouldMatchByLine(archiveRelocPattern, unmapRgn1Pattern, unmapRgn0Pattern);
}
}
});
}