Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/runtime/SharedArchiveFile/SharedBaseAddress.java
32284 views
/*1* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test SharedBaseAddress25* @summary Test variety of values for SharedBaseAddress, making sure26* VM handles normal values as well as edge values w/o a crash.27* @library /testlibrary28* @run main SharedBaseAddress29*/3031import com.oracle.java.testlibrary.*;3233public class SharedBaseAddress {3435// shared base address test table36private static final String[] testTable = {37"1g", "8g", "64g","512g", "4t",38"32t", "128t", "0",39"1", "64k", "64M"40};4142public static void main(String[] args) throws Exception {43if (Platform.isSolaris() && Platform.isSparc())44return;4546for (String testEntry : testTable) {47System.out.println("sharedBaseAddress = " + testEntry);4849ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(50"-XX:+UnlockDiagnosticVMOptions",51"-XX:SharedArchiveFile=test.jsa",52"-XX:SharedBaseAddress=" + testEntry,53"-Xshare:dump");5455OutputAnalyzer output = new OutputAnalyzer(pb.start());5657output.shouldContain("Loading classes to share");5859try {60pb = ProcessTools.createJavaProcessBuilder(61"-XX:+UnlockDiagnosticVMOptions",62"-XX:SharedArchiveFile=test.jsa",63"-Xshare:on",64"-version");65output = new OutputAnalyzer(pb.start());66output.shouldContain("sharing");67output.shouldHaveExitValue(0);68} catch (RuntimeException e) {69output.shouldContain("Unable to use shared archive");70output.shouldHaveExitValue(1);71}72}73}74}757677