test/runtime/SharedArchiveFile/SharedStringsRunAuto.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2015, 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) 2015, 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.
*** 32,68 ****
* @modules java.base/jdk.internal.misc
* java.management
* @run main SharedStringsRunAuto
*/
! import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import java.io.File;
public class SharedStringsRunAuto {
public static void main(String[] args) throws Exception {
! // Dump
! ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
! "-XX:+UnlockDiagnosticVMOptions",
! "-XX:SharedArchiveFile=./SharedStringsRunAuto.jsa",
! "-XX:+UseCompressedOops", "-XX:+UseG1GC",
! "-XX:+PrintSharedSpaces",
! "-Xshare:dump");
!
! new OutputAnalyzer(pb.start())
! .shouldContain("Loading classes to share")
! .shouldContain("Shared string table stats")
! .shouldHaveExitValue(0);
!
! // Run with -Xshare:auto
! pb = ProcessTools.createJavaProcessBuilder(
! "-XX:+UnlockDiagnosticVMOptions",
! "-XX:SharedArchiveFile=./SharedStringsRunAuto.jsa",
! "-XX:+UseCompressedOops", "-XX:+UseG1GC",
! "-Xshare:auto",
! "-version");
!
! new OutputAnalyzer(pb.start())
! .shouldMatch("(java|openjdk) version")
! .shouldHaveExitValue(0);
}
}
--- 32,48 ----
* @modules java.base/jdk.internal.misc
* java.management
* @run main SharedStringsRunAuto
*/
! import jdk.test.lib.cds.CDSTestUtils;
import jdk.test.lib.process.OutputAnalyzer;
import java.io.File;
public class SharedStringsRunAuto {
public static void main(String[] args) throws Exception {
! OutputAnalyzer out =
! CDSTestUtils.createArchive("-XX:+UseCompressedOops", "-XX:+UseG1GC");
! CDSTestUtils.checkDump(out, "Shared string table stats");
! CDSTestUtils.runWithArchiveAndCheck("-XX:+UseCompressedOops", "-XX:+UseG1GC");
}
}