--- old/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java 2018-08-09 13:43:55.845806370 -0700 +++ new/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java 2018-08-09 13:43:55.733806374 -0700 @@ -38,6 +38,8 @@ import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; import java.io.File; +import jtreg.SkippedException; + public class ArchiveDoesNotExist { public static void main(String[] args) throws Exception { @@ -51,7 +53,9 @@ // -Xshare=on OutputAnalyzer out = CDSTestUtils.runWithArchive(opts); - if (!CDSTestUtils.isUnableToMap(out)) { + if (CDSTestUtils.isUnableToMap(out)) { + throw new SkippedException(CDSTestUtils.UnableToMapMsg); + } else { out.shouldContain("Specified shared archive not found") .shouldHaveExitValue(1); } --- old/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java 2018-08-09 13:43:56.129806362 -0700 +++ new/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java 2018-08-09 13:43:56.017806365 -0700 @@ -33,6 +33,7 @@ import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; +import jtreg.SkippedException; public class CdsDifferentCompactStrings { public static void main(String[] args) throws Exception { @@ -50,7 +51,9 @@ CDSTestUtils.checkDump(out); out = CDSTestUtils.runWithArchive(loadCompactStringsArgument); - if (!CDSTestUtils.isUnableToMap(out)) { + if (CDSTestUtils.isUnableToMap(out)) { + throw new SkippedException(CDSTestUtils.UnableToMapMsg); + } else { out.shouldMatch("The shared archive file's CompactStrings " + "setting .* does not equal the current CompactStrings setting") .shouldHaveExitValue(1); --- old/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java 2018-08-09 13:43:56.421806353 -0700 +++ new/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java 2018-08-09 13:43:56.305806357 -0700 @@ -35,7 +35,7 @@ import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import java.io.File; +import jtreg.SkippedException; public class NonBootLoaderClasses { public static void main(String[] args) throws Exception { @@ -56,7 +56,9 @@ "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName, "-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary"); OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "print-shared-archive"); - if (!CDSTestUtils.isUnableToMap(out)) { + if (CDSTestUtils.isUnableToMap(out)) { + throw new SkippedException(CDSTestUtils.UnableToMapMsg); + } else { out.shouldContain("archive is valid") .shouldHaveExitValue(0) // Should report success in error code. .shouldContain(PLATFORM_CLASS.replace('/', '.')) --- old/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java 2018-08-09 13:43:56.705806345 -0700 +++ new/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java 2018-08-09 13:43:56.593806348 -0700 @@ -35,7 +35,7 @@ import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; - +import jtreg.SkippedException; public class PrintSharedArchiveAndExit { public static void main(String[] args) throws Exception { @@ -49,7 +49,10 @@ "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName, "-XX:+PrintSharedArchiveAndExit", "-version"); out = CDSTestUtils.executeAndLog(pb, "print-shared-archive-and-version"); - if (!CDSTestUtils.isUnableToMap(out)) { + + if (CDSTestUtils.isUnableToMap(out)) { + throw new SkippedException(CDSTestUtils.UnableToMapMsg); + } else { out.shouldContain("archive is valid") .shouldNotContain("java version") // Should not print JVM version .shouldHaveExitValue(0); // Should report success in error code. @@ -59,10 +62,13 @@ "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName, "-XX:+PrintSharedArchiveAndExit"); out = CDSTestUtils.executeAndLog(pb, "print-shared-archive"); - if (!CDSTestUtils.isUnableToMap(out)) { + + if (CDSTestUtils.isUnableToMap(out)) { + throw new SkippedException(CDSTestUtils.UnableToMapMsg); + } else { out.shouldContain("archive is valid") .shouldNotContain("Usage:") // Should not print JVM help message - .shouldHaveExitValue(0); // Should report success in error code. + .shouldHaveExitValue(0); // Should report success in error code. } } } --- old/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java 2018-08-09 13:43:56.997806336 -0700 +++ new/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java 2018-08-09 13:43:56.885806340 -0700 @@ -33,6 +33,7 @@ import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; +import jtreg.SkippedException; public class SharedSymbolTableBucketSize { public static void main(String[] args) throws Exception { @@ -43,14 +44,16 @@ + Integer.valueOf(bucket_size)); CDSTestUtils.checkDump(output); - if (!CDSTestUtils.isUnableToMap(output)) { - String s = output.firstMatch("Average bucket size : .*"); - Float f = Float.parseFloat(s.substring(25)); - int size = Math.round(f); - if (size != bucket_size) { - throw new Exception("FAILED: incorrect bucket size " + size + - ", expect " + bucket_size); - } + if (CDSTestUtils.isUnableToMap(output)) { + throw new SkippedException(CDSTestUtils.UnableToMapMsg); + } + + String s = output.firstMatch("Average bucket size : .*"); + Float f = Float.parseFloat(s.substring(25)); + int size = Math.round(f); + if (size != bucket_size) { + throw new Exception("FAILED: incorrect bucket size " + size + + ", expect " + bucket_size); } // Invalid SharedSymbolTableBucketSize input --- old/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformTestCommon.java 2018-08-09 13:43:57.289806328 -0700 +++ new/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformTestCommon.java 2018-08-09 13:43:57.173806331 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, 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 @@ -23,6 +23,7 @@ import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; +import jtreg.SkippedException; // This class contains methods common to all transformation test cases @@ -101,8 +102,10 @@ // If we were not able to map an archive, // then do not perform other checks, since // there was no sharing at all - if (CDSTestUtils.isUnableToMap(out)) - return; + if (CDSTestUtils.isUnableToMap(out)) { + throw new SkippedException(CDSTestUtils.UnableToMapMsg); + } + String childVmName = child.replace('.', '/'); String parentVmName = parent.replace('.', '/'); --- old/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java 2018-08-09 13:43:57.585806319 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java 2018-08-09 13:43:57.469806322 -0700 @@ -36,8 +36,10 @@ * @run main/othervm -XX:-CompactStrings InvalidFileFormat */ -import jdk.test.lib.process.OutputAnalyzer; import java.io.File; +import jdk.test.lib.cds.CDSTestUtils; +import jdk.test.lib.process.OutputAnalyzer; +import jtreg.SkippedException; // Checking most common error use cases // This file is not an exhastive test of various shared data file corruption @@ -65,8 +67,11 @@ OutputAnalyzer out = SharedStringsUtils.dumpWithoutChecks(TestCommon.list("HelloString"), "invalidFormat" + File.separator + dataFileName); - if (!TestCommon.isUnableToMap(out)) + if (CDSTestUtils.isUnableToMap(out)) { + throw new SkippedException(CDSTestUtils.UnableToMapMsg); + } else { out.shouldContain(expectedWarning).shouldHaveExitValue(1); + } } } --- old/test/lib/jdk/test/lib/cds/CDSTestUtils.java 2018-08-09 13:43:57.881806310 -0700 +++ new/test/lib/jdk/test/lib/cds/CDSTestUtils.java 2018-08-09 13:43:57.765806313 -0700 @@ -32,7 +32,7 @@ import jdk.test.lib.Utils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; - +import jtreg.SkippedException; // This class contains common test utilities for testing CDS public class CDSTestUtils { @@ -223,7 +223,7 @@ public static final String TestTimeoutFactor = System.getProperty("test.timeout.factor", "1.0"); public static final String UnableToMapMsg = - "Unable to map shared archive: test did not complete; assumed PASS"; + "Unable to map shared archive: test did not complete"; // Create bootstrap CDS archive, // use extra JVM command line args as a prefix. @@ -314,8 +314,7 @@ // at given address. This behavior is platform-specific, machine config-specific // and can be random (see ASLR). if (isUnableToMap(output)) { - System.out.println(UnableToMapMsg); - return true; + throw new SkippedException(UnableToMapMsg); } if (e != null) { @@ -446,8 +445,7 @@ int expectedExitValue, String... extraMatches) throws Exception { if (isUnableToMap(output)) { - System.out.println(UnableToMapMsg); - return output; + throw new SkippedException(UnableToMapMsg); } output.shouldHaveExitValue(expectedExitValue);