8228672: [TESTBUG] gc/metaspace/TestSizeTransitions.java fails on 32-bit platforms
authorshade
Tue, 30 Jul 2019 22:15:23 +0200
changeset 57596 dad0062bb7f3
parent 57595 d629735db937
child 57597 ec78fddafd88
8228672: [TESTBUG] gc/metaspace/TestSizeTransitions.java fails on 32-bit platforms Reviewed-by: tonyp
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<String> 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);