Path: blob/master/test/hotspot/jtreg/gc/arguments/TestCompressedClassFlags.java
40942 views
/*1* Copyright (c) 2013, 2020, 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*/2223package gc.arguments;2425import jdk.test.lib.process.OutputAnalyzer;26import jdk.test.lib.process.ProcessTools;27import jdk.test.lib.Platform;2829/*30* @test31* @bug 801510732* @summary Tests that VM prints a warning when -XX:CompressedClassSpaceSize33* is used together with -XX:-UseCompressedClassPointers34* @library /test/lib35* @library /36* @modules java.base/jdk.internal.misc37* java.management38* @run driver gc.arguments.TestCompressedClassFlags39*/40public class TestCompressedClassFlags {41public static void main(String[] args) throws Exception {42if (Platform.is64bit()) {43OutputAnalyzer output = runJava("-XX:CompressedClassSpaceSize=1g",44"-XX:-UseCompressedClassPointers",45"-version");46output.shouldContain("warning");47output.shouldNotContain("error");48output.shouldHaveExitValue(0);49}50}5152private static OutputAnalyzer runJava(String ... args) throws Exception {53ProcessBuilder pb = GCArguments.createJavaProcessBuilder(args);54return new OutputAnalyzer(pb.start());55}56}575859