test/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformRelatedClasses.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 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) 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.
*** 54,67 **** // // Other utility/helper classes and files used in this test: // TransformerAgent - an agent that is used when JVM-under-test is executed // to transform specific strings inside specified classes // TransformerAgent.mf - accompanies transformer agent - // CDSTestUtils - Test Utilities common to all CDS tests import java.io.File; import java.util.ArrayList; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; public class TransformRelatedClasses { --- 54,68 ---- // // Other utility/helper classes and files used in this test: // TransformerAgent - an agent that is used when JVM-under-test is executed // to transform specific strings inside specified classes // TransformerAgent.mf - accompanies transformer agent import java.io.File; import java.util.ArrayList; + import jdk.test.lib.cds.CDSOptions; + import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; public class TransformRelatedClasses {
*** 141,179 **** testJar = ClassFileInstaller.writeJar(parent + "-" + child + ".jar", testClasses); // create an archive ! File classList = CDSTestUtils.makeClassList("transform-" + parent, ! testNames); ! ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, ! "-Xbootclasspath/a:" + testJar, ! "-XX:+UnlockDiagnosticVMOptions", ! "-XX:ExtraSharedClassListFile=" + ! classList.getPath(), ! "-XX:SharedArchiveFile=" + archiveName, ! "-XX:+PrintSharedSpaces", ! "-Xshare:dump"); ! OutputAnalyzer out = new OutputAnalyzer(pb.start()); ! CDSTestUtils.checkDump(out); } private void runTest(TestEntry entry) throws Exception { log("runTest(): testCaseId = " + entry.testCaseId); // execute with archive String agentParam = "-javaagent:" + agentJar + "=" + TransformTestCommon.getAgentParams(entry, parent, child); ! ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, ! "-Xbootclasspath/a:" + testJar, ! "-XX:+UnlockDiagnosticVMOptions", ! "-XX:SharedArchiveFile=" + archiveName, ! "-Xlog:class+load=info", ! "-Xshare:on", "-showversion", ! agentParam, child); ! OutputAnalyzer out = new OutputAnalyzer(pb.start()); TransformTestCommon.checkResults(entry, out, parent, child); } } --- 142,170 ---- testJar = ClassFileInstaller.writeJar(parent + "-" + child + ".jar", testClasses); // create an archive ! String classList = ! CDSTestUtils.makeClassList("transform-" + parent, testNames).getPath(); ! ! CDSTestUtils.createArchiveAndCheck("-Xbootclasspath/a:" + testJar, ! "-XX:ExtraSharedClassListFile=" + classList); } private void runTest(TestEntry entry) throws Exception { log("runTest(): testCaseId = " + entry.testCaseId); // execute with archive String agentParam = "-javaagent:" + agentJar + "=" + TransformTestCommon.getAgentParams(entry, parent, child); ! CDSOptions opts = new CDSOptions() ! .addPrefix("-Xbootclasspath/a:" + testJar, "-Xlog:class+load=info") ! .setUseVersion(false) ! .addSuffix( "-showversion",agentParam, child); + OutputAnalyzer out = CDSTestUtils.runWithArchive(opts); TransformTestCommon.checkResults(entry, out, parent, child); } }