Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.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 DefaultUseWithClient25* @summary Test default behavior of sharing with -client26* @library /testlibrary27* @run main DefaultUseWithClient28* @bug 803222429*/3031import com.oracle.java.testlibrary.*;32import java.io.File;3334public class DefaultUseWithClient {35public static void main(String[] args) throws Exception {36String fileName = "test.jsa";3738// On 32-bit windows CDS should be on by default in "-client" config39// Skip this test on any other platform40boolean is32BitWindows = (Platform.isWindows() && Platform.is32bit());41if (!is32BitWindows) {42System.out.println("Test only applicable on 32-bit Windows. Skipping");43return;44}4546// create the archive47ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(48"-XX:+UnlockDiagnosticVMOptions",49"-XX:SharedArchiveFile=./" + fileName,50"-Xshare:dump");51OutputAnalyzer output = new OutputAnalyzer(pb.start());52output.shouldHaveExitValue(0);5354pb = ProcessTools.createJavaProcessBuilder(55"-XX:+UnlockDiagnosticVMOptions",56"-XX:SharedArchiveFile=./" + fileName,57"-client",58"-XX:+PrintSharedSpaces",59"-version");6061output = new OutputAnalyzer(pb.start());62try {63output.shouldContain("sharing");64} catch (RuntimeException e) {65// if sharing failed due to ASLR or similar reasons,66// check whether sharing was attempted at all (UseSharedSpaces)67output.shouldContain("UseSharedSpaces:");68}69output.shouldHaveExitValue(0);70}71}727374