Java Code Examples for com.oracle.java.testlibrary.ProcessTools#executeProcess()
The following examples show how to use
com.oracle.java.testlibrary.ProcessTools#executeProcess() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestShrinkDefragmentedHeap.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception, Throwable { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:InitialHeapSize=" + INITIAL_HEAP_SIZE, "-Xmn" + MINIMAL_YOUNG_SIZE, "-XX:MinHeapFreeRatio=10", "-XX:MaxHeapFreeRatio=11", "-XX:+UseG1GC", "-XX:G1HeapRegionSize=" + REGION_SIZE, "-XX:-ExplicitGCInvokesConcurrent", "-verbose:gc", GCTest.class.getName() ); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldHaveExitValue(0); }
Example 2
Source File: TestShrinkDefragmentedHeap.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception, Throwable { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:InitialHeapSize=" + INITIAL_HEAP_SIZE, "-Xmn" + MINIMAL_YOUNG_SIZE, "-XX:MinHeapFreeRatio=10", "-XX:MaxHeapFreeRatio=11", "-XX:+UseG1GC", "-XX:G1HeapRegionSize=" + REGION_SIZE, "-XX:-ExplicitGCInvokesConcurrent", "-verbose:gc", GCTest.class.getName() ); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldHaveExitValue(0); }
Example 3
Source File: TestShrinkDefragmentedHeap.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception, Throwable { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:InitialHeapSize=" + INITIAL_HEAP_SIZE, "-Xmn" + MINIMAL_YOUNG_SIZE, "-XX:MinHeapFreeRatio=10", "-XX:MaxHeapFreeRatio=11", "-XX:+UseG1GC", "-XX:G1HeapRegionSize=" + REGION_SIZE, "-XX:-ExplicitGCInvokesConcurrent", "-verbose:gc", GCTest.class.getName() ); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldHaveExitValue(0); }
Example 4
Source File: TestShrinkDefragmentedHeap.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception, Throwable { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:InitialHeapSize=" + INITIAL_HEAP_SIZE, "-Xmn" + MINIMAL_YOUNG_SIZE, "-XX:MinHeapFreeRatio=10", "-XX:MaxHeapFreeRatio=11", "-XX:+UseG1GC", "-XX:G1HeapRegionSize=" + REGION_SIZE, "-XX:-ExplicitGCInvokesConcurrent", "-verbose:gc", GCTest.class.getName() ); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldHaveExitValue(0); }
Example 5
Source File: TestShrinkDefragmentedHeap.java From hottub with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception, Throwable { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:InitialHeapSize=" + INITIAL_HEAP_SIZE, "-Xmn" + MINIMAL_YOUNG_SIZE, "-XX:MinHeapFreeRatio=10", "-XX:MaxHeapFreeRatio=11", "-XX:+UseG1GC", "-XX:G1HeapRegionSize=" + REGION_SIZE, "-XX:-ExplicitGCInvokesConcurrent", "-verbose:gc", GCTest.class.getName() ); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldHaveExitValue(0); }
Example 6
Source File: AvailableProcessors.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Throwable { if (args.length > 0) checkProcessors(Integer.parseInt(args[0])); else { // run ourselves under different cpu configurations // using the taskset command String taskset; final String taskset1 = "/bin/taskset"; final String taskset2 = "/usr/bin/taskset"; if (new File(taskset1).exists()) taskset = taskset1; else if (new File(taskset2).exists()) taskset = taskset2; else { System.out.println("Skipping test: could not find taskset command"); return; } int available = Runtime.getRuntime().availableProcessors(); if (available == 1) { System.out.println("Skipping test: only one processor available"); return; } // Get the java command we want to execute // Enable logging for easier failure diagnosis ProcessBuilder master = ProcessTools.createJavaProcessBuilder(false, "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintActiveCpus", "AvailableProcessors"); int[] expected = new int[] { 1, available/2, available-1, available }; for (int i : expected) { System.out.println("Testing for " + i + " processors ..."); int max = i - 1; ArrayList<String> cmdline = new ArrayList<>(master.command()); // prepend taskset command cmdline.add(0, "0-" + max); cmdline.add(0, "-c"); cmdline.add(0, taskset); // append expected processor count cmdline.add(String.valueOf(i)); ProcessBuilder pb = new ProcessBuilder(cmdline); System.out.println("Final command line: " + ProcessTools.getCommandLine(pb)); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldContain(SUCCESS_STRING); } } }
Example 7
Source File: AvailableProcessors.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Throwable { if (args.length > 0) checkProcessors(Integer.parseInt(args[0])); else { // run ourselves under different cpu configurations // using the taskset command String taskset; final String taskset1 = "/bin/taskset"; final String taskset2 = "/usr/bin/taskset"; if (new File(taskset1).exists()) taskset = taskset1; else if (new File(taskset2).exists()) taskset = taskset2; else { System.out.println("Skipping test: could not find taskset command"); return; } int available = Runtime.getRuntime().availableProcessors(); if (available == 1) { System.out.println("Skipping test: only one processor available"); return; } // Get the java command we want to execute // Enable logging for easier failure diagnosis ProcessBuilder master = ProcessTools.createJavaProcessBuilder(false, "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintActiveCpus", "AvailableProcessors"); int[] expected = new int[] { 1, available/2, available-1, available }; for (int i : expected) { System.out.println("Testing for " + i + " processors ..."); int max = i - 1; ArrayList<String> cmdline = new ArrayList<>(master.command()); // prepend taskset command cmdline.add(0, "0-" + max); cmdline.add(0, "-c"); cmdline.add(0, taskset); // append expected processor count cmdline.add(String.valueOf(i)); ProcessBuilder pb = new ProcessBuilder(cmdline); System.out.println("Final command line: " + ProcessTools.getCommandLine(pb)); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldContain(SUCCESS_STRING); } } }
Example 8
Source File: AvailableProcessors.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Throwable { if (args.length > 0) checkProcessors(Integer.parseInt(args[0])); else { // run ourselves under different cpu configurations // using the taskset command String taskset; final String taskset1 = "/bin/taskset"; final String taskset2 = "/usr/bin/taskset"; if (new File(taskset1).exists()) taskset = taskset1; else if (new File(taskset2).exists()) taskset = taskset2; else { System.out.println("Skipping test: could not find taskset command"); return; } int available = Runtime.getRuntime().availableProcessors(); if (available == 1) { System.out.println("Skipping test: only one processor available"); return; } // Get the java command we want to execute // Enable logging for easier failure diagnosis ProcessBuilder master = ProcessTools.createJavaProcessBuilder(false, "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintActiveCpus", "AvailableProcessors"); int[] expected = new int[] { 1, available/2, available-1, available }; for (int i : expected) { System.out.println("Testing for " + i + " processors ..."); int max = i - 1; ArrayList<String> cmdline = new ArrayList<>(master.command()); // prepend taskset command cmdline.add(0, "0-" + max); cmdline.add(0, "-c"); cmdline.add(0, taskset); // append expected processor count cmdline.add(String.valueOf(i)); ProcessBuilder pb = new ProcessBuilder(cmdline); System.out.println("Final command line: " + ProcessTools.getCommandLine(pb)); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldContain(SUCCESS_STRING); } } }