test/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2013, 2016, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2013, 2017, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 28,38 **** * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ ! import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; public class CdsDifferentCompactStrings { public static void main(String[] args) throws Exception { createAndLoadSharedArchive("+", "-"); --- 28,38 ---- * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ ! import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; public class CdsDifferentCompactStrings { public static void main(String[] args) throws Exception { createAndLoadSharedArchive("+", "-");
*** 43,76 **** throws Exception { String createCompactStringsArgument = "-XX:" + create + "CompactStrings"; String loadCompactStringsArgument = "-XX:" + load + "CompactStrings"; ! String filename = "./CdsDifferentCompactStrings" + create + ".jsa"; ! ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( ! "-XX:+UnlockDiagnosticVMOptions", ! "-XX:SharedArchiveFile=" + filename, ! "-Xshare:dump", ! createCompactStringsArgument); ! ! OutputAnalyzer output = new OutputAnalyzer(pb.start()); ! output.shouldContain("Loading classes to share"); ! output.shouldHaveExitValue(0); ! ! pb = ProcessTools.createJavaProcessBuilder( ! "-XX:+UnlockDiagnosticVMOptions", ! "-XX:SharedArchiveFile=" + filename, ! "-Xshare:on", ! loadCompactStringsArgument, ! "-version"); ! ! output = new OutputAnalyzer(pb.start()); ! try { ! output.shouldContain("The shared archive file's CompactStrings " + ! "setting .* does not equal the current CompactStrings setting"); ! } catch (RuntimeException e) { ! output.shouldContain("Unable to use shared archive"); } - output.shouldHaveExitValue(1); } } --- 43,58 ---- throws Exception { String createCompactStringsArgument = "-XX:" + create + "CompactStrings"; String loadCompactStringsArgument = "-XX:" + load + "CompactStrings"; ! OutputAnalyzer out = CDSTestUtils.createArchive(createCompactStringsArgument); ! CDSTestUtils.checkDump(out); ! out = CDSTestUtils.runWithArchive(loadCompactStringsArgument); ! if (!CDSTestUtils.isUnableToMap(out)) { ! out.shouldMatch("The shared archive file's CompactStrings " + ! "setting .* does not equal the current CompactStrings setting") ! .shouldHaveExitValue(1); } } }