diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java index 3fe60de2364..4d01f9a26c8 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -51,6 +51,10 @@ public static void main(String[] args) throws Exception { CDSTestUtils.createArchiveAndCheck(opts); ClhsdbLauncher test = new ClhsdbLauncher(); + // This test could possibly cause some unexpected SA exceptions because one + // or more threads are active during the stack trace. Ignore them. The threads + // we care about should still be present in the output. + test.ignoreExceptions(); theApp = LingeredApp.startApp( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=" + sharedArchiveName, diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java index 961311f5d5b..ffb95fd9f70 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -41,9 +41,15 @@ public class ClhsdbLauncher { private Process toolProcess; + private boolean ignoreExceptions; public ClhsdbLauncher() { toolProcess = null; + ignoreExceptions = false; + } + + public void ignoreExceptions() { + ignoreExceptions = true; } /** @@ -147,11 +153,13 @@ private String runCmd(List commands, // -Xcheck:jni might be set via TEST_VM_OPTS. Make sure there are no warnings. oa.shouldNotMatch("^WARNING: JNI local refs:.*$"); oa.shouldNotMatch("^WARNING in native method:.*$"); - // This will detect most SA failures, including during the attach. - oa.shouldNotMatch("^sun.jvm.hotspot.debugger.DebuggerException:.*$"); - // This will detect unexpected exceptions, like NPEs and asserts, that are caught - // by sun.jvm.hotspot.CommandProcessor. - oa.shouldNotMatch("^Error: .*$"); + if (!ignoreExceptions) { + // This will detect most SA failures, including during the attach. + oa.shouldNotMatch("^sun.jvm.hotspot.debugger.DebuggerException:.*$"); + // This will detect unexpected exceptions, like NPEs and asserts, that are caught + // by sun.jvm.hotspot.CommandProcessor. + oa.shouldNotMatch("^Error: .*$"); + } String[] parts = output.split("hsdb>"); for (String cmd : commands) { diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbWhere.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbWhere.java index 4b665ac002d..8295a479fa0 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbWhere.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbWhere.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -45,6 +45,10 @@ public static void main(String[] args) throws Exception { LingeredApp theApp = null; try { ClhsdbLauncher test = new ClhsdbLauncher(); + // This test could possibly cause some unexpected SA exceptions because one + // or more threads are active during the stack trace. Ignore them. The threads + // we care about should still be present in the output. + test.ignoreExceptions(); theApp = LingeredApp.startApp(); System.out.println("Started LingeredApp with pid " + theApp.getPid());