--- old/test/hotspot/jtreg/runtime/appcds/SharedArchiveFile.java 2018-04-24 20:05:07.640072763 -0400 +++ new/test/hotspot/jtreg/runtime/appcds/SharedArchiveFile.java 2018-04-24 20:05:06.327997218 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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,7 +23,7 @@ */ /* * @test - * @summary The diagnostic option, -XX:SharedArchiveFile can be unlocked using -XX:+UseAppCDS + * @summary Dumping -XX:SharedArchiveFile should succeed without extra flag to unlock * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc @@ -44,28 +44,21 @@ boolean isProduct = !Platform.isDebugBuild(); String appJar = JarBuilder.getOrCreateHelloJar(); - // 1) Using -XX:SharedArchiveFile without -XX:+UseAppCDS should fail - // on product binary without -XX:+UnlockDiagnosticVMOptions. - if (isProduct) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, - "-XX:SharedArchiveFile=./SharedArchiveFile.jsa", "-Xshare:dump"); - OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "dump"); - out.shouldContain("Error: VM option 'SharedArchiveFile' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions."); - } - - // 2) Dumping with -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile - // should always succeed. - CDSTestUtils.createArchive("-XX:+UnlockDiagnosticVMOptions") - .shouldContain("Dumping"); + // 1) Dumping -XX:SharedArchiveFile without -XX:+UseAppCDS should + // succeed with all binary. + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, + "-cp", appJar, "-XX:SharedArchiveFile=./SharedArchiveFile.jsa", "-Xshare:dump"); + OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "dump"); + out.shouldContain("Dumping"); - // 3) Using -XX:SharedArchiveFile with -XX:+UseAppCDS should work + // 2) Using -XX:SharedArchiveFile with -XX:+UseAppCDS should work // on product binary by default. OutputAnalyzer output3 = TestCommon.dump(appJar, TestCommon.list("Hello")); output3.shouldContain("Dumping"); output3 = TestCommon.exec(appJar, "Hello"); TestCommon.checkExec(output3, "Hello World"); - // 4) Using -XX:+UseAppCDS should not affect other diagnostic flags, + // 3) Using -XX:+UseAppCDS should not affect other diagnostic flags, // such as LogEvents OutputAnalyzer output4 = TestCommon.exec(appJar, "-XX:+LogEvents", "Hello"); if (isProduct) { @@ -74,7 +67,7 @@ TestCommon.checkExec(output4, "Hello World"); } - // 5) 8066921 - Extra -XX:+UseAppCDS + // 4) 8066921 - Extra -XX:+UseAppCDS TestCommon.testDump(appJar, TestCommon.list("Hello"), "-XX:+UseAppCDS"); OutputAnalyzer output5 = TestCommon.exec(appJar, "-XX:+UseAppCDS", "Hello"); TestCommon.checkExec(output5);