From 496317030433f335d64ba75d31aeeebbcc061685 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Fri, 24 Apr 2026 02:07:41 +0000 Subject: [PATCH] 8345631: TestRegionSamplingLogging.java#generational-rotation intermittent fails Reviewed-by: wkemper, ruili --- .../jtreg/gc/shenandoah/TestRegionSamplingLogging.java | 4 +++- .../jtreg/gc/shenandoah/TestShenandoahRegionLogging.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/gc/shenandoah/TestRegionSamplingLogging.java b/test/hotspot/jtreg/gc/shenandoah/TestRegionSamplingLogging.java index 0017328b517..5c9536223f3 100644 --- a/test/hotspot/jtreg/gc/shenandoah/TestRegionSamplingLogging.java +++ b/test/hotspot/jtreg/gc/shenandoah/TestRegionSamplingLogging.java @@ -59,8 +59,10 @@ public class TestRegionSamplingLogging { } File directory = new File("."); - File[] files = directory.listFiles((dir, name) -> name.startsWith("region-snapshots") && name.endsWith(".log")); + File[] files = directory.listFiles((dir, name) -> name.startsWith("region-snapshots")); System.out.println(Arrays.toString(files)); + + // Expect one or more log files when region logging is enabled if (files == null || files.length == 0) { throw new IllegalStateException("Did not find expected snapshot log file."); } diff --git a/test/hotspot/jtreg/gc/shenandoah/TestShenandoahRegionLogging.java b/test/hotspot/jtreg/gc/shenandoah/TestShenandoahRegionLogging.java index 81e66c9d0cb..a5fe1589d25 100644 --- a/test/hotspot/jtreg/gc/shenandoah/TestShenandoahRegionLogging.java +++ b/test/hotspot/jtreg/gc/shenandoah/TestShenandoahRegionLogging.java @@ -33,6 +33,7 @@ * TestShenandoahRegionLogging */ import java.io.File; +import java.util.Arrays; public class TestShenandoahRegionLogging { public static void main(String[] args) throws Exception { @@ -40,9 +41,10 @@ public class TestShenandoahRegionLogging { File directory = new File("."); File[] files = directory.listFiles((dir, name) -> name.startsWith("region-snapshots")); + System.out.println(Arrays.toString(files)); // Expect one or more log files when region logging is enabled - if (files.length == 0) { + if (files == null || files.length == 0) { throw new Error("Expected at least one log file for region sampling data."); } }