# HG changeset patch # User shade # Date 1564517723 -7200 # Node ID dad0062bb7f303f943e7f9e8dc7e318d208c30f6 # Parent d629735db9374d96cddf78cd5a7d489470d2ac90 8228672: [TESTBUG] gc/metaspace/TestSizeTransitions.java fails on 32-bit platforms Reviewed-by: tonyp diff -r d629735db937 -r dad0062bb7f3 test/hotspot/jtreg/gc/metaspace/TestSizeTransitions.java --- a/test/hotspot/jtreg/gc/metaspace/TestSizeTransitions.java Tue Jul 30 09:46:06 2019 -0700 +++ b/test/hotspot/jtreg/gc/metaspace/TestSizeTransitions.java Tue Jul 30 22:15:23 2019 +0200 @@ -25,8 +25,11 @@ package gc.metaspace; +import jdk.test.lib.Platform; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; +import java.util.ArrayList; +import java.util.List; /* @test TestSizeTransitionsSerial * @key gc @@ -104,22 +107,31 @@ throw new RuntimeException("wrong number of args: " + args.length); } + final boolean hasCoops = Platform.is64bit(); final boolean useCoops = Boolean.parseBoolean(args[0]); final String gcArg = args[1]; - final String[] jvmArgs = { - useCoops ? "-XX:+UseCompressedOops" : "-XX:-UseCompressedOops", - gcArg, - "-Xmx256m", - "-Xlog:gc,gc+metaspace=info", - TestSizeTransitions.Run.class.getName() - }; + + if (!hasCoops && useCoops) { + // No need to run this configuration. + System.out.println("Skipping test."); + return; + } + + List jvmArgs = new ArrayList<>(); + if (hasCoops) { + jvmArgs.add(useCoops ? "-XX:+UseCompressedOops" : "-XX:-UseCompressedOops"); + } + jvmArgs.add(gcArg); + jvmArgs.add("-Xmx256m"); + jvmArgs.add("-Xlog:gc,gc+metaspace=info"); + jvmArgs.add(TestSizeTransitions.Run.class.getName()); System.out.println("JVM args:"); for (String a : jvmArgs) { System.out.println(" " + a); } - final ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(jvmArgs); + final ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(jvmArgs.toArray(new String[0])); final OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println(output.getStdout()); output.shouldHaveExitValue(0);