Skip to content

Commit

Permalink
8314426: runtime/os/TestTrimNative.java is failing on slow machines
Browse files Browse the repository at this point in the history
Backport-of: 20e94784c9f7c30e95550c72aedb5e986a153114
  • Loading branch information
shipilev committed Aug 24, 2023
1 parent 1c3409b commit f07aa56
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/hotspot/jtreg/runtime/os/TestTrimNative.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ private static void checkExpectedLogMessages(OutputAnalyzer output, boolean expe
if (expectEnabled) {
output.shouldContain("Periodic native trim enabled (interval: " + expectedInterval + " ms");
output.shouldContain("Native heap trimmer start");
output.shouldContain("Native heap trimmer stop");
} else {
output.shouldNotContain("Periodic native trim enabled");
}
Expand Down Expand Up @@ -251,7 +250,7 @@ public static void main(String[] args) throws Exception {
System.gc();

// give GC time to react
System.out.println("Sleeping...");
System.out.println("Sleeping for " + sleeptime + " ms...");
Thread.sleep(sleeptime);
System.out.println("Done.");
}
Expand Down Expand Up @@ -296,12 +295,15 @@ public static void main(String[] args) throws Exception {

case "trimNativeLowInterval":
case "trimNativeLowIntervalStrict": {
long ms1 = System.currentTimeMillis();
OutputAnalyzer output = runTestWithOptions(
new String[] { "-XX:+UnlockExperimentalVMOptions", "-XX:TrimNativeHeapInterval=1" },
new String[] { TestTrimNative.Tester.class.getName(), "0" }
);
long ms2 = System.currentTimeMillis();
int maxTrimsExpected = (int)(ms2 - ms1); // 1ms trim interval
checkExpectedLogMessages(output, true, 1);
parseOutputAndLookForNegativeTrim(output, 1, 3000, strictTesting);
parseOutputAndLookForNegativeTrim(output, 1, (int)maxTrimsExpected, strictTesting);
} break;

case "testOffOnNonCompliantPlatforms": {
Expand Down

1 comment on commit f07aa56

@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.