com.oracle.java.testlibrary.OutputAnalyzer Java Examples

The following examples show how to use com.oracle.java.testlibrary.OutputAnalyzer. 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: TestGCId.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static void testGCId(String gcFlag, String logFlag) throws Exception {
  // GCID logging enabled
  ProcessBuilder pb_enabled =
    ProcessTools.createJavaProcessBuilder("-XX:+" + gcFlag, "-XX:+" + logFlag, "-Xmx10M", "-XX:+PrintGCID", GCTest.class.getName());
  verifyContainsGCIDs(new OutputAnalyzer(pb_enabled.start()));

  // GCID logging disabled
  ProcessBuilder pb_disabled =
    ProcessTools.createJavaProcessBuilder("-XX:+" + gcFlag, "-XX:+" + logFlag, "-Xmx10M", "-XX:-PrintGCID", GCTest.class.getName());
  verifyContainsNoGCIDs(new OutputAnalyzer(pb_disabled.start()));

  // GCID logging default
  ProcessBuilder pb_default =
    ProcessTools.createJavaProcessBuilder("-XX:+" + gcFlag, "-XX:+" + logFlag, "-Xmx10M", GCTest.class.getName());
  verifyContainsNoGCIDs(new OutputAnalyzer(pb_default.start()));
}
 
Example #2
Source File: TestEagerReclaimHumongousRegions.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
        "-XX:+UseG1GC",
        "-Xms128M",
        "-Xmx128M",
        "-Xmn16M",
        "-XX:+PrintGC",
        ReclaimRegionFast.class.getName());

    Pattern p = Pattern.compile("Full GC");

    OutputAnalyzer output = new OutputAnalyzer(pb.start());

    int found = 0;
    Matcher m = p.matcher(output.getStdout());
    while (m.find()) { found++; }
    System.out.println("Issued " + found + " Full GCs");
    Asserts.assertLT(found, 10, "Found that " + found + " Full GCs were issued. This is larger than the bound. Eager reclaim seems to not work at all");

    output.shouldHaveExitValue(0);
}
 
Example #3
Source File: TestVerifySubSet.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static OutputAnalyzer runTest(String subset) throws Exception {
    ArrayList<String> vmOpts = new ArrayList();

    Collections.addAll(vmOpts, getTestJavaOpts());
    Collections.addAll(vmOpts, new String[] {"-XX:+UnlockDiagnosticVMOptions",
                                             "-XX:+VerifyBeforeGC",
                                             "-XX:+VerifyAfterGC",
                                             "-XX:VerifySubSet="+subset,
                                             RunSystemGC.class.getName()});
    ProcessBuilder pb =
        ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
    OutputAnalyzer output = new OutputAnalyzer(pb.start());

    System.out.println("Output:\n" + output.getOutput());
    return output;
}
 
Example #4
Source File: TestVerifySubSet.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {

        OutputAnalyzer output;

        output = runTest("heap, threads, codecache, metaspace");
        output.shouldContain("Heap");
        output.shouldContain("Threads");
        output.shouldContain("CodeCache");
        output.shouldContain("MetaspaceAux");
        output.shouldNotContain("SymbolTable");
        output.shouldNotContain("StringTable");
        output.shouldNotContain("SystemDictionary");
        output.shouldNotContain("CodeCache Oops");
        output.shouldHaveExitValue(0);

        output = runTest("hello, threads, codecache, metaspace");
        output.shouldContain("memory sub-system is unknown, please correct it");
        output.shouldNotContain("Threads");
        output.shouldNotContain("CodeCache");
        output.shouldNotContain("MetaspaceAux");
        output.shouldHaveExitValue(1);
    }
 
Example #5
Source File: TestCMSClassUnloadingEnabledHWM.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static OutputAnalyzer run(boolean enableUnloading) throws Exception {
  ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
    "-Xbootclasspath/a:.",
    "-XX:+UnlockDiagnosticVMOptions",
    "-XX:+WhiteBoxAPI",
    "-Xmx128m",
    "-XX:CMSMaxAbortablePrecleanTime=1",
    "-XX:CMSWaitDuration=50",
    "-XX:MetaspaceSize=" + MetaspaceSize,
    "-Xmn" + YoungGenSize,
    "-XX:+UseConcMarkSweepGC",
    "-XX:" + (enableUnloading ? "+" : "-") + "CMSClassUnloadingEnabled",
    "-XX:+PrintHeapAtGC",
    "-XX:+PrintGCDetails",
    "-XX:+PrintGCTimeStamps",
    TestCMSClassUnloadingEnabledHWM.AllocateBeyondMetaspaceSize.class.getName(),
    "" + MetaspaceSize);
  return new OutputAnalyzer(pb.start());
}
 
Example #6
Source File: TestEagerReclaimHumongousRegionsClearMarkBits.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
        "-XX:+UseG1GC",
        "-Xms128M",
        "-Xmx128M",
        "-Xmn2M",
        "-XX:G1HeapRegionSize=1M",
        "-XX:InitiatingHeapOccupancyPercent=0", // Want to have as much as possible initial marks.
        "-XX:+PrintGC",
        "-XX:+VerifyAfterGC",
        "-XX:ConcGCThreads=1", // Want to make marking as slow as possible.
        "-XX:+IgnoreUnrecognizedVMOptions", // G1VerifyBitmaps is develop only.
        "-XX:+G1VerifyBitmaps",
        ReclaimRegionFast.class.getName());
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
    output.shouldHaveExitValue(0);
}
 
Example #7
Source File: TestVerifySubSet.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {

        OutputAnalyzer output;

        output = runTest("heap, threads, codecache, metaspace");
        output.shouldContain("Heap");
        output.shouldContain("Threads");
        output.shouldContain("CodeCache");
        output.shouldContain("MetaspaceAux");
        output.shouldNotContain("SymbolTable");
        output.shouldNotContain("StringTable");
        output.shouldNotContain("SystemDictionary");
        output.shouldNotContain("CodeCache Oops");
        output.shouldHaveExitValue(0);

        output = runTest("hello, threads, codecache, metaspace");
        output.shouldContain("memory sub-system is unknown, please correct it");
        output.shouldNotContain("Threads");
        output.shouldNotContain("CodeCache");
        output.shouldNotContain("MetaspaceAux");
        output.shouldHaveExitValue(1);
    }
 
Example #8
Source File: TestShrinkDefragmentedHeap.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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 #9
Source File: Test2GbHeap.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
  ArrayList<String> testArguments = new ArrayList<String>();

  testArguments.add("-XX:+UseG1GC");
  testArguments.add("-Xmx2g");
  testArguments.add("-version");

  ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(testArguments.toArray(new String[0]));

  OutputAnalyzer output = new OutputAnalyzer(pb.start());

  // Avoid failing test for setups not supported.
  if (output.getOutput().contains("Could not reserve enough space for 2097152KB object heap")) {
    // Will fail on machines with too little memory (and Windows 32-bit VM), ignore such failures.
    output.shouldHaveExitValue(1);
  } else if (output.getOutput().contains("G1 GC is disabled in this release")) {
    // G1 is not supported on embedded, ignore such failures.
    output.shouldHaveExitValue(1);
  } else {
    // Normally everything should be fine.
    output.shouldHaveExitValue(0);
  }
}
 
Example #10
Source File: TestEagerReclaimHumongousRegionsWithRefs.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
        "-XX:+UseG1GC",
        "-Xms128M",
        "-Xmx128M",
        "-Xmn16M",
        "-XX:+PrintGC",
        ReclaimRegionFast.class.getName());

    Pattern p = Pattern.compile("Full GC");

    OutputAnalyzer output = new OutputAnalyzer(pb.start());

    int found = 0;
    Matcher m = p.matcher(output.getStdout());
    while (m.find()) {
        found++;
    }
    System.out.println("Issued " + found + " Full GCs");

    assertLessThan(found, 10, "Found that " + found + " Full GCs were issued. This is larger than the bound. Eager reclaim of objects once referenced from old gen seems to not work at all");
    output.shouldHaveExitValue(0);
}
 
Example #11
Source File: TestLargePagesFlags.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void expect(Flag... expectedFlags) throws Exception {
  if (useFlags == null) {
    throw new IllegalStateException("Must run use() before expect()");
  }

  OutputAnalyzer output = executeNewJVM(useFlags);

  for (Flag flag : expectedFlags) {
    System.out.println("Looking for: " + flag.flagString());
    String strValue = output.firstMatch(".* " + flag.name() +  " .* :?= (\\S+).*", 1);

    if (strValue == null) {
      throw new RuntimeException("Flag " + flag.name() + " couldn't be found");
    }

    if (!flag.value().equals(strValue)) {
      throw new RuntimeException("Wrong value for: " + flag.name()
                                 + " expected: " + flag.value()
                                 + " got: " + strValue);
    }
  }

  output.shouldHaveExitValue(0);
}
 
Example #12
Source File: FinalizerInfoTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
void run() throws Exception {
    try {
        lock.lock();
        for(int i = 0; i < objectsCount; ++i) {
            new MyObject();
        }
        System.out.println("Objects initialized: " + objectsCount);
        System.gc();

        while(wasTrapped < 1) {
            // Waiting for gc thread.
        }


        String pid = Integer.toString(ProcessTools.getProcessId());
        ProcessBuilder pb = new ProcessBuilder();
        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, cmd});
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
        output.shouldContain("MyObject");
    } finally {
        lock.unlock();
    }
}
 
Example #13
Source File: DockerTestUtils.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Run Java inside the docker image with specified parameters and options.
 *
 * @param DockerRunOptions optins for running docker
 *
 * @return output of the run command
 * @throws Exception
 */
public static OutputAnalyzer dockerRunJava(DockerRunOptions opts) throws Exception {
    ArrayList<String> cmd = new ArrayList<>();

    cmd.add("docker");
    cmd.add("run");
    if (opts.tty)
        cmd.add("--tty=true");
    if (opts.removeContainerAfterUse)
        cmd.add("--rm");

    cmd.addAll(opts.dockerOpts);
    cmd.add(opts.imageNameAndTag);
    cmd.add(opts.command);

    cmd.addAll(opts.javaOpts);
    if (opts.appendTestJavaOptions) {
        Collections.addAll(cmd, Utils.getTestJavaOpts());
    }

    cmd.add(opts.classToRun);
    cmd.addAll(opts.classParams);
    return execute(cmd);
}
 
Example #14
Source File: TestCMSClassUnloadingEnabledHWM.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static OutputAnalyzer run(boolean enableUnloading) throws Exception {
  ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
    "-Xbootclasspath/a:.",
    "-XX:+UnlockDiagnosticVMOptions",
    "-XX:+WhiteBoxAPI",
    "-Xmx128m",
    "-XX:CMSMaxAbortablePrecleanTime=1",
    "-XX:CMSWaitDuration=50",
    "-XX:MetaspaceSize=" + MetaspaceSize,
    "-Xmn" + YoungGenSize,
    "-XX:+UseConcMarkSweepGC",
    "-XX:" + (enableUnloading ? "+" : "-") + "CMSClassUnloadingEnabled",
    "-XX:+PrintHeapAtGC",
    "-XX:+PrintGCDetails",
    "-XX:+PrintGCTimeStamps",
    TestCMSClassUnloadingEnabledHWM.AllocateBeyondMetaspaceSize.class.getName(),
    "" + MetaspaceSize);
  return new OutputAnalyzer(pb.start());
}
 
Example #15
Source File: TestLargePagesFlags.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void expect(Flag... expectedFlags) throws Exception {
  if (useFlags == null) {
    throw new IllegalStateException("Must run use() before expect()");
  }

  OutputAnalyzer output = executeNewJVM(useFlags);

  for (Flag flag : expectedFlags) {
    System.out.println("Looking for: " + flag.flagString());
    String strValue = output.firstMatch(".* " + flag.name() +  " .* :?= (\\S+).*", 1);

    if (strValue == null) {
      throw new RuntimeException("Flag " + flag.name() + " couldn't be found");
    }

    if (!flag.value().equals(strValue)) {
      throw new RuntimeException("Wrong value for: " + flag.name()
                                 + " expected: " + flag.value()
                                 + " got: " + strValue);
    }
  }

  output.shouldHaveExitValue(0);
}
 
Example #16
Source File: Test2GbHeap.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
  ArrayList<String> testArguments = new ArrayList<String>();

  testArguments.add("-XX:+UseG1GC");
  testArguments.add("-Xmx2g");
  testArguments.add("-version");

  ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(testArguments.toArray(new String[0]));

  OutputAnalyzer output = new OutputAnalyzer(pb.start());

  // Avoid failing test for setups not supported.
  if (output.getOutput().contains("Could not reserve enough space for 2097152KB object heap")) {
    // Will fail on machines with too little memory (and Windows 32-bit VM), ignore such failures.
    output.shouldHaveExitValue(1);
  } else if (output.getOutput().contains("G1 GC is disabled in this release")) {
    // G1 is not supported on embedded, ignore such failures.
    output.shouldHaveExitValue(1);
  } else {
    // Normally everything should be fine.
    output.shouldHaveExitValue(0);
  }
}
 
Example #17
Source File: TestEagerReclaimHumongousRegionsWithRefs.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
        "-XX:+UseG1GC",
        "-Xms128M",
        "-Xmx128M",
        "-Xmn16M",
        "-XX:+PrintGC",
        ReclaimRegionFast.class.getName());

    Pattern p = Pattern.compile("Full GC");

    OutputAnalyzer output = new OutputAnalyzer(pb.start());

    int found = 0;
    Matcher m = p.matcher(output.getStdout());
    while (m.find()) {
        found++;
    }
    System.out.println("Issued " + found + " Full GCs");

    assertLessThan(found, 10, "Found that " + found + " Full GCs were issued. This is larger than the bound. Eager reclaim of objects once referenced from old gen seems to not work at all");
    output.shouldHaveExitValue(0);
}
 
Example #18
Source File: TestEagerReclaimHumongousRegionsClearMarkBits.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
        "-XX:+UseG1GC",
        "-Xms128M",
        "-Xmx128M",
        "-Xmn2M",
        "-XX:G1HeapRegionSize=1M",
        "-XX:InitiatingHeapOccupancyPercent=0", // Want to have as much as possible initial marks.
        "-XX:+PrintGC",
        "-XX:+VerifyAfterGC",
        "-XX:ConcGCThreads=1", // Want to make marking as slow as possible.
        "-XX:+IgnoreUnrecognizedVMOptions", // G1VerifyBitmaps is develop only.
        "-XX:+G1VerifyBitmaps",
        ReclaimRegionFast.class.getName());
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
    output.shouldHaveExitValue(0);
}
 
Example #19
Source File: TestG1ClassUnloadingHWM.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static OutputAnalyzer run(boolean enableUnloading) throws Exception {
  ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
    "-Xbootclasspath/a:.",
    "-XX:+UnlockDiagnosticVMOptions",
    "-XX:+WhiteBoxAPI",
    "-XX:MetaspaceSize=" + MetaspaceSize,
    "-Xmn" + YoungGenSize,
    "-XX:+UseG1GC",
    "-XX:" + (enableUnloading ? "+" : "-") + "ClassUnloadingWithConcurrentMark",
    "-XX:+PrintHeapAtGC",
    "-XX:+PrintGCDetails",
    TestG1ClassUnloadingHWM.AllocateBeyondMetaspaceSize.class.getName(),
    "" + MetaspaceSize,
    "" + YoungGenSize);
  return new OutputAnalyzer(pb.start());
}
 
Example #20
Source File: TestGCId.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static void testGCId(String gcFlag, String logFlag) throws Exception {
  // GCID logging enabled
  ProcessBuilder pb_enabled =
    ProcessTools.createJavaProcessBuilder("-XX:+" + gcFlag, "-XX:+" + logFlag, "-Xmx10M", "-XX:+PrintGCID", GCTest.class.getName());
  verifyContainsGCIDs(new OutputAnalyzer(pb_enabled.start()));

  // GCID logging disabled
  ProcessBuilder pb_disabled =
    ProcessTools.createJavaProcessBuilder("-XX:+" + gcFlag, "-XX:+" + logFlag, "-Xmx10M", "-XX:-PrintGCID", GCTest.class.getName());
  verifyContainsNoGCIDs(new OutputAnalyzer(pb_disabled.start()));

  // GCID logging default
  ProcessBuilder pb_default =
    ProcessTools.createJavaProcessBuilder("-XX:+" + gcFlag, "-XX:+" + logFlag, "-Xmx10M", GCTest.class.getName());
  verifyContainsNoGCIDs(new OutputAnalyzer(pb_default.start()));
}
 
Example #21
Source File: TestExitOnOutOfMemoryError.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    if (args.length == 1) {
        // This should guarantee to throw:
        // java.lang.OutOfMemoryError: Requested array size exceeds VM limit
        try {
            Object[] oa = new Object[Integer.MAX_VALUE];
            throw new Error("OOME not triggered");
        } catch (OutOfMemoryError err) {
            throw new Error("OOME didn't terminate JVM!");
        }
    }

    // else this is the main test
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+ExitOnOutOfMemoryError",
            "-Xmx64m", TestExitOnOutOfMemoryError.class.getName(), "throwOOME");
    OutputAnalyzer output = new OutputAnalyzer(pb.start());

    /*
     * Actual output should look like this:
     * Terminating due to java.lang.OutOfMemoryError: Requested array size exceeds VM limit
     */
    output.shouldHaveExitValue(3);
    output.shouldContain("Terminating due to java.lang.OutOfMemoryError: Requested array size exceeds VM limit");
    System.out.println("PASSED");
}
 
Example #22
Source File: UseCountedLoopSafepoints.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main (String args[]) throws Exception {
    if (args.length == 1) {
        final int loops = Integer.parseInt(args[0]);
        for (int i = 0; i < loops; i++) {
            _num.addAndGet(1);
        }
    } else {
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
                "-XX:+IgnoreUnrecognizedVMOptions",
                "-XX:-TieredCompilation",
                "-XX:+UseBiasedLocking",
                "-XX:BiasedLockingStartupDelay=500",
                "-XX:+SafepointTimeout",
                "-XX:SafepointTimeoutDelay=2000",
                "-XX:+UseCountedLoopSafepoints",
                "UseCountedLoopSafepoints",
                "2000000000"
                );
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
        output.shouldNotContain("Timeout detected");
        output.shouldHaveExitValue(0);
    }
}
 
Example #23
Source File: UseCountedLoopSafepoints.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main (String args[]) throws Exception {
    if (args.length == 1) {
        final int loops = Integer.parseInt(args[0]);
        for (int i = 0; i < loops; i++) {
            _num.addAndGet(1);
        }
    } else {
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
                "-XX:+IgnoreUnrecognizedVMOptions",
                "-XX:-TieredCompilation",
                "-XX:+UseBiasedLocking",
                "-XX:BiasedLockingStartupDelay=500",
                "-XX:+SafepointTimeout",
                "-XX:SafepointTimeoutDelay=2000",
                "-XX:+UseCountedLoopSafepoints",
                "UseCountedLoopSafepoints",
                "2000000000"
                );
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
        output.shouldNotContain("Timeout detected");
        output.shouldHaveExitValue(0);
    }
}
 
Example #24
Source File: TestG1TraceEagerReclaimHumongousObjects.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void testGCLogs() throws Exception {

    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
                                               "-Xms128M",
                                               "-Xmx128M",
                                               "-Xmn16M",
                                               "-XX:G1HeapRegionSize=1M",
                                               "-XX:+PrintGC",
                                               "-XX:+UnlockExperimentalVMOptions",
                                               "-XX:G1LogLevel=finest",
                                               "-XX:+G1TraceEagerReclaimHumongousObjects",
                                               GCTest.class.getName());

    OutputAnalyzer output = new OutputAnalyzer(pb.start());

    // As G1EagerReclaimHumongousObjects is set(default), below logs should be displayed.
    // And GCTest doesn't have humongous objects, so values should be zero.
    output.shouldContain("[Humongous Reclaim");
    output.shouldContain("[Humongous Total: 0]");
    output.shouldContain("[Humongous Candidate: 0]");
    output.shouldContain("[Humongous Reclaimed: 0]");

    output.shouldHaveExitValue(0);
  }
 
Example #25
Source File: TestCMS.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
  ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseConcMarkSweepGC", "-version");
  OutputAnalyzer output = new OutputAnalyzer(pb.start());
  output.shouldNotContain("deprecated");
  output.shouldNotContain("error");
  output.shouldHaveExitValue(0);
}
 
Example #26
Source File: TestG1ClassUnloadingHWM.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void testWithG1ClassUnloading() throws Exception {
  // -XX:+ClassUnloadingWithConcurrentMark is used, so we expect a concurrent cycle instead of a full GC.
  OutputAnalyzer out = runWithG1ClassUnloading();

  out.shouldMatch(".*initial-mark.*");
  out.shouldNotMatch(".*Full GC.*");
}
 
Example #27
Source File: TestMetaspaceSizeFlags.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static MetaspaceFlags runAndGetValue(long maxMetaspaceSize, long metaspaceSize) throws Exception {
  OutputAnalyzer output = run(maxMetaspaceSize, metaspaceSize);
  output.shouldNotMatch("Error occurred during initialization of VM\n.*");

  String stringMaxMetaspaceSize = output.firstMatch(".* MaxMetaspaceSize .* := (\\d+).*", 1);
  String stringMetaspaceSize = output.firstMatch(".* MetaspaceSize .* := (\\d+).*", 1);

  return new MetaspaceFlags(Long.parseLong(stringMaxMetaspaceSize),
                            Long.parseLong(stringMetaspaceSize));
}
 
Example #28
Source File: TestParNewCMS.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
  ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
  OutputAnalyzer output = new OutputAnalyzer(pb.start());
  output.shouldNotContain("deprecated");
  output.shouldNotContain("error");
  output.shouldHaveExitValue(0);
}
 
Example #29
Source File: TestCMSClassUnloadingEnabledHWM.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void testWithCMSClassUnloading() throws Exception {
  // -XX:+CMSClassUnloadingEnabled is used, so we expect a concurrent cycle instead of a full GC.
  OutputAnalyzer out = runWithCMSClassUnloading();

  out.shouldMatch(".*CMS Initial Mark.*");
  out.shouldNotMatch(".*Full GC.*");
}
 
Example #30
Source File: TestG1ClassUnloadingHWM.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void testWithG1ClassUnloading() throws Exception {
  // -XX:+ClassUnloadingWithConcurrentMark is used, so we expect a concurrent cycle instead of a full GC.
  OutputAnalyzer out = runWithG1ClassUnloading();

  out.shouldMatch(".*initial-mark.*");
  out.shouldNotMatch(".*Full GC.*");
}