8234625: hs test serviceability/sa/ClhsdbCDSCore.java fails on macOS 10.15
authormbaesken
Thu, 28 Nov 2019 09:23:09 +0100
changeset 59317 7089399d6ade
parent 59316 753ab8dcdbba
child 59318 70021dbed82b
8234625: hs test serviceability/sa/ClhsdbCDSCore.java fails on macOS 10.15 Reviewed-by: clanger, iignatyev
test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java	Thu Nov 28 22:29:07 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java	Thu Nov 28 09:23:09 2019 +0100
@@ -111,8 +111,20 @@
             if (coreFileLocation == null) {
                 if (Platform.isOSX()) {
                     File coresDir = new File("/cores");
-                    if (!coresDir.isDirectory() || !coresDir.canWrite()) {
-                        throw new Error("cores is not a directory or does not have write permissions");
+                    if (!coresDir.isDirectory()) {
+                        throw new Error("cores is not a directory");
+                    }
+                    // the /cores directory is usually not writable on macOS 10.15
+                    final String osVersion = System.getProperty("os.version");
+                    if (osVersion == null) {
+                        throw new Error("Cannot query the 'os.version' property!");
+                    }
+                    if (!coresDir.canWrite()) {
+                        if (osVersion.startsWith("10.15")) {
+                            throw new SkippedException("/cores is not writable");
+                        } else {
+                            throw new Error("cores does not have write permissions");
+                        }
                     }
                 } else if (Platform.isLinux()) {
                     // Check if a crash report tool is installed.