|
31 | 31 | * @library /test/lib
|
32 | 32 | * @modules java.base/jdk.internal.misc
|
33 | 33 | * @requires vm.bits == "64"
|
34 |
| - * @run main gc.nvdimm.TestAllocateOldGenAtMultiple -XX:+UseG1GC |
| 34 | + * @run driver gc.nvdimm.TestAllocateOldGenAtMultiple |
35 | 35 | */
|
36 | 36 |
|
37 | 37 | import jdk.test.lib.JDKToolFinder;
|
|
42 | 42 |
|
43 | 43 | public class TestAllocateOldGenAtMultiple {
|
44 | 44 | public static void main(String args[]) throws Exception {
|
45 |
| - ArrayList<String> vmOpts = new ArrayList<>(); |
46 |
| - String[] testVmOpts = null; |
47 |
| - |
| 45 | + ArrayList<String> flags = new ArrayList<>(); |
48 | 46 | String test_dir = System.getProperty("test.dir", ".");
|
49 | 47 |
|
50 |
| - String testVmOptsStr = System.getProperty("test.java.opts"); |
51 |
| - if (!testVmOptsStr.isEmpty()) { |
52 |
| - testVmOpts = testVmOptsStr.split(" "); |
53 |
| - } |
54 |
| - |
55 |
| - // Extra options for each of the sub-tests |
56 |
| - String[] extraOptsList = new String[] { |
57 |
| - "-Xmx32m -Xms32m -XX:+UseCompressedOops", // 1. With compressedoops enabled. |
58 |
| - "-Xmx32m -Xms32m -XX:-UseCompressedOops", // 2. With compressedoops disabled. |
59 |
| - "-Xmx32m -Xms32m -XX:HeapBaseMinAddress=3g", // 3. With user specified HeapBaseMinAddress. |
60 |
| - "-Xmx4g -Xms4g", // 4. With larger heap size (UnscaledNarrowOop not possible). |
61 |
| - "-Xmx4g -Xms4g -XX:+UseLargePages", // 5. Set UseLargePages. |
62 |
| - "-Xmx4g -Xms4g -XX:+UseNUMA" // 6. Set UseNUMA. |
| 48 | + // Extra flags for each of the sub-tests |
| 49 | + String[][] extraFlagsList = { |
| 50 | + {"-Xmx32m", "-Xms32m", "-XX:+UseCompressedOops"}, // 1. With compressedoops enabled. |
| 51 | + {"-Xmx32m", "-Xms32m", "-XX:-UseCompressedOops"}, // 2. With compressedoops disabled. |
| 52 | + {"-Xmx32m", "-Xms32m", "-XX:HeapBaseMinAddress=3g"}, // 3. With user specified HeapBaseMinAddress. |
| 53 | + {"-Xmx4g", "-Xms4g"}, // 4. With larger heap size (UnscaledNarrowOop not possible). |
| 54 | + {"-Xmx4g", "-Xms4g", "-XX:+UseLargePages"}, // 5. Set UseLargePages. |
| 55 | + {"-Xmx4g", "-Xms4g", "-XX:+UseNUMA"} // 6. Set UseNUMA. |
63 | 56 | };
|
64 | 57 |
|
65 |
| - for(String extraOpts : extraOptsList) { |
66 |
| - vmOpts.clear(); |
67 |
| - if(testVmOpts != null) { |
68 |
| - Collections.addAll(vmOpts, testVmOpts); |
69 |
| - } |
70 |
| - // Add extra options specific to the sub-test. |
71 |
| - String[] extraOptsArray = extraOpts.split(" "); |
72 |
| - if(extraOptsArray != null) { |
73 |
| - Collections.addAll(vmOpts, extraOptsArray); |
74 |
| - } |
75 |
| - // Add common options |
76 |
| - Collections.addAll(vmOpts, new String[] {"-XX:+UnlockExperimentalVMOptions", |
| 58 | + for (String[] extraFlags : extraFlagsList) { |
| 59 | + flags.clear(); |
| 60 | + // Add extra flags specific to the sub-test. |
| 61 | + Collections.addAll(flags, extraFlags); |
| 62 | + // Add common flags |
| 63 | + Collections.addAll(flags, new String[] {"-XX:+UnlockExperimentalVMOptions", |
77 | 64 | "-XX:AllocateOldGenAt=" + test_dir,
|
78 | 65 | "-version"});
|
79 |
| - |
80 |
| - System.out.print("Testing:\n" + JDKToolFinder.getJDKTool("java")); |
81 |
| - for (int i = 0; i < vmOpts.size(); i += 1) { |
82 |
| - System.out.print(" " + vmOpts.get(i)); |
83 |
| - } |
84 |
| - System.out.println(); |
85 |
| - |
86 | 66 | ProcessBuilder pb =
|
87 |
| - ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()])); |
| 67 | + ProcessTools.createJavaProcessBuilder(true, flags.toArray(String[]::new)); |
88 | 68 | OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
89 | 69 |
|
90 | 70 | System.out.println("Output:\n" + output.getOutput());
|
|
0 commit comments