8345631: TestRegionSamplingLogging.java#generational-rotation intermittent fails

Reviewed-by: wkemper, ruili
This commit is contained in:
SendaoYan 2026-04-24 02:07:41 +00:00
parent 0091060d34
commit 4963170304
2 changed files with 6 additions and 2 deletions

View File

@ -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.");
}

View File

@ -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.");
}
}