8321299: runtime/logging/ClassLoadUnloadTest.java doesn't reliably trigger class unloading
Reviewed-by: coleenp, dholmes
This commit is contained in:
parent
35b00e640b
commit
5cae7d20ad
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2024, 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
|
||||
@ -70,10 +70,13 @@ public class ClassLoadUnloadTest {
|
||||
|
||||
// Use the same command-line heap size setting as ../ClassUnload/UnloadTest.java
|
||||
static OutputAnalyzer exec(String... args) throws Exception {
|
||||
String classPath = System.getProperty("test.class.path", ".");
|
||||
|
||||
// Sub-process does not get all the properties automatically, so the test class path needs to be passed explicitly
|
||||
List<String> argsList = new ArrayList<>();
|
||||
Collections.addAll(argsList, args);
|
||||
Collections.addAll(argsList, "-Xmn8m", "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:+WhiteBoxAPI", "-XX:+ClassUnloading", ClassUnloadTestMain.class.getName());
|
||||
"-XX:+WhiteBoxAPI", "-XX:+ClassUnloading", "-Dtest.class.path=" + classPath, ClassUnloadTestMain.class.getName());
|
||||
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(argsList);
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldHaveExitValue(0);
|
||||
@ -86,7 +89,7 @@ public class ClassLoadUnloadTest {
|
||||
|
||||
// -Xlog:class+unload=info
|
||||
output = exec("-Xlog:class+unload=info");
|
||||
checkFor(output, "[class,unload]", "unloading class");
|
||||
checkFor(output, "[class,unload]", "unloading class test.Empty");
|
||||
|
||||
// -Xlog:class+unload=off
|
||||
output = exec("-Xlog:class+unload=off");
|
||||
|
Loading…
Reference in New Issue
Block a user