Skip to content

Commit f07aa56

Browse files
committed
8314426: runtime/os/TestTrimNative.java is failing on slow machines
Backport-of: 20e94784c9f7c30e95550c72aedb5e986a153114
1 parent 1c3409b commit f07aa56

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/hotspot/jtreg/runtime/os/TestTrimNative.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ private static void checkExpectedLogMessages(OutputAnalyzer output, boolean expe
170170
if (expectEnabled) {
171171
output.shouldContain("Periodic native trim enabled (interval: " + expectedInterval + " ms");
172172
output.shouldContain("Native heap trimmer start");
173-
output.shouldContain("Native heap trimmer stop");
174173
} else {
175174
output.shouldNotContain("Periodic native trim enabled");
176175
}
@@ -251,7 +250,7 @@ public static void main(String[] args) throws Exception {
251250
System.gc();
252251

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

297296
case "trimNativeLowInterval":
298297
case "trimNativeLowIntervalStrict": {
298+
long ms1 = System.currentTimeMillis();
299299
OutputAnalyzer output = runTestWithOptions(
300300
new String[] { "-XX:+UnlockExperimentalVMOptions", "-XX:TrimNativeHeapInterval=1" },
301301
new String[] { TestTrimNative.Tester.class.getName(), "0" }
302302
);
303+
long ms2 = System.currentTimeMillis();
304+
int maxTrimsExpected = (int)(ms2 - ms1); // 1ms trim interval
303305
checkExpectedLogMessages(output, true, 1);
304-
parseOutputAndLookForNegativeTrim(output, 1, 3000, strictTesting);
306+
parseOutputAndLookForNegativeTrim(output, 1, (int)maxTrimsExpected, strictTesting);
305307
} break;
306308

307309
case "testOffOnNonCompliantPlatforms": {

0 commit comments

Comments
 (0)