Skip to content
Permalink
Browse files
8258732: runtime/cds/appcds/dynamicArchive/DynamicArchiveRelocationTe…
…st.java fails

Reviewed-by: minqi, iklam
  • Loading branch information
calvinccheung committed Feb 5, 2021
1 parent f9df366 commit 0218917109dcb64ff698420b14d282bbee7edae4
Showing with 20 additions and 7 deletions.
  1. +20 −7 test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicArchiveRelocationTest.java
@@ -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 @@ static void doTest() throws Exception {
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 @@ static void doTest() throws Exception {
"-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);
}
}
});
}

0 comments on commit 0218917

Please sign in to comment.