From 6080ccd23239a5209dfb21bd0a413a116709af76 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Wed, 29 Oct 2025 18:40:14 +0000 Subject: [PATCH] 8370797: Test runtime/ErrorHandling/AccessZeroNKlassHitsProtectionZone.java failed on macos 26 Reviewed-by: stuefe, kvn --- .../AccessZeroNKlassHitsProtectionZone.java | 6 ++++- .../jdk/test/lib/process/OutputAnalyzer.java | 23 ++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/AccessZeroNKlassHitsProtectionZone.java b/test/hotspot/jtreg/runtime/ErrorHandling/AccessZeroNKlassHitsProtectionZone.java index 0e36fdce7d8..a9d957bac18 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/AccessZeroNKlassHitsProtectionZone.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/AccessZeroNKlassHitsProtectionZone.java @@ -142,7 +142,11 @@ public class AccessZeroNKlassHitsProtectionZone { for (forceBase = start; forceBase < end; forceBase += step) { String thisBaseString = String.format("0x%016X", forceBase).toLowerCase(); output = run_test(COH, CDS, thisBaseString); - if (output.contains("CompressedClassSpaceBaseAddress=" + thisBaseString + " given, but reserving class space failed.")) { + if (output.contains("CompressedClassSpaceBaseAddress=" + thisBaseString + " given, but reserving class space failed.") || + output.matches ("CompressedClassSpaceBaseAddress=" + thisBaseString + " given with shift .*, cannot be used to encode class pointers")) { + // possible output: + // CompressedClassSpaceBaseAddress=0x0000000c00000000 given, but reserving class space failed. + // CompressedClassSpaceBaseAddress=0x0000000d00000000 given with shift 6, cannot be used to encode class pointers // try next one } else if (output.contains("Successfully forced class space address to " + thisBaseString)) { break; diff --git a/test/lib/jdk/test/lib/process/OutputAnalyzer.java b/test/lib/jdk/test/lib/process/OutputAnalyzer.java index 3c5be74558b..fa5e30dd815 100644 --- a/test/lib/jdk/test/lib/process/OutputAnalyzer.java +++ b/test/lib/jdk/test/lib/process/OutputAnalyzer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, 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 @@ -354,6 +354,27 @@ public final class OutputAnalyzer { return this; } + /** + * Returns true if stdout matches the given pattern + */ + public boolean stdoutMatches(String regexp) { + return getStdout().matches(regexp); + } + + /** + * Returns true if stderr matches the given pattern + */ + public boolean stderrMatches(String regexp) { + return getStderr().matches(regexp); + } + + /** + * Returns true if either stdout or stderr matches the given pattern + */ + public boolean matches(String regexp) { + return stdoutMatches(regexp) || stderrMatches(regexp); + } + /** * Verify that the stdout and stderr contents of output buffer matches * the pattern