From f5ab7dff402a3152f5d5736cc6521b4be617eccf Mon Sep 17 00:00:00 2001 From: Axel Boldt-Christmas Date: Tue, 21 May 2024 06:14:44 +0000 Subject: [PATCH] 8332494: java/util/zip/EntryCount64k.java failing with java.lang.RuntimeException: '\\A\\Z' missing from stderr Reviewed-by: jpai, stefank, dholmes --- test/jdk/java/util/zip/EntryCount64k.java | 2 +- .../jdk/test/lib/process/OutputAnalyzer.java | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/test/jdk/java/util/zip/EntryCount64k.java b/test/jdk/java/util/zip/EntryCount64k.java index 2dac7643de2..d8c46d22364 100644 --- a/test/jdk/java/util/zip/EntryCount64k.java +++ b/test/jdk/java/util/zip/EntryCount64k.java @@ -163,6 +163,6 @@ public class EntryCount64k { OutputAnalyzer a = ProcessTools.executeTestJava("-jar", zipFile.getName()); a.shouldHaveExitValue(0); a.stdoutShouldMatch("\\AMain\\Z"); - a.stderrShouldMatch("\\A\\Z"); + a.stderrShouldMatchIgnoreDeprecatedWarnings("\\A\\Z"); } } diff --git a/test/lib/jdk/test/lib/process/OutputAnalyzer.java b/test/lib/jdk/test/lib/process/OutputAnalyzer.java index 48a0b098d48..24bb18e3d4b 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, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, 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 @@ -665,7 +665,7 @@ public final class OutputAnalyzer { /** * Verify that the stderr contents of output buffer matches the pattern, - * after filtering out the Hotespot warning messages + * after filtering out the Hotspot warning messages * * @param pattern * @throws RuntimeException If the pattern was not found @@ -681,6 +681,24 @@ public final class OutputAnalyzer { return this; } + /** + * Verify that the stderr contents of output buffer matches the pattern, + * after filtering out the Hotspot deprecation warning messages + * + * @param pattern + * @throws RuntimeException If the pattern was not found + */ + public OutputAnalyzer stderrShouldMatchIgnoreDeprecatedWarnings(String pattern) { + String stderr = getStderr().replaceAll(deprecatedmsg + "\\R", ""); + Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr); + if (!matcher.find()) { + reportDiagnosticSummary(); + throw new RuntimeException("'" + pattern + + "' missing from stderr"); + } + return this; + } + /** * Returns the contents of the output buffer (stdout and stderr), without those * JVM warning msgs, as list of strings. Output is split by newlines.