8157452: [TESTBUG] PLAB tests don't handle unexpected GC

Reviewed-by: dfazunen, tschatzl
This commit is contained in:
Michail Chernov 2016-05-27 17:48:56 +03:00
parent c7a54bbb06
commit 286b967574
4 changed files with 29 additions and 10 deletions

@ -122,10 +122,7 @@ public class TestPLABPromotion {
List<String> options = PLABUtils.prepareOptions(testCase.toOptions());
options.add(AppPLABPromotion.class.getName());
OutputAnalyzer out = ProcessTools.executeTestJvm(options.toArray(new String[options.size()]));
if (out.getExitValue() != 0) {
System.out.println(out.getOutput());
throw new RuntimeException("Expect exit code 0.");
}
PLABUtils.commonCheck(out);
output = out.getOutput();
checkResults(testCase);
}

@ -94,10 +94,7 @@ public class TestPLABResize {
List<String> options = PLABUtils.prepareOptions(testCase.toOptions());
options.add(AppPLABResize.class.getName());
OutputAnalyzer out = ProcessTools.executeTestJvm(options.toArray(new String[options.size()]));
if (out.getExitValue() != 0) {
System.out.println(out.getOutput());
throw new RuntimeException("Exit code is not 0");
}
PLABUtils.commonCheck(out);
checkResults(out.getOutput(), testCase);
}
}
@ -124,6 +121,11 @@ public class TestPLABResize {
// The test case does 3 rounds of allocations. The second round of N allocations and GC's
// has a decreasing size of allocations so that iterations N to 2*N -1 will be of decreasing size.
// The third round with iterations 2*N to 3*N -1 has increasing sizes of allocation.
if ( plabSizes.size() != testCase.iterations * 3 ) {
System.out.println(output);
throw new RuntimeException ("Expects for " + testCase.iterations * 3 + " PLAB entries in log, found " + plabSizes.size());
}
long startDesiredPLABSize = plabSizes.get(testCase.getIterations());
long endDesiredPLABSize = plabSizes.get(testCase.getIterations() * 2 - 1);

@ -169,7 +169,12 @@ final public class LogParser {
* @return
**/
public PlabInfo getSpecifiedStats(long specifiedGcId, LogParser.ReportType type, List<String> fieldsName) {
return getSpecifiedStats(Arrays.asList(specifiedGcId), type, fieldsName, true).get(specifiedGcId);
PlabInfo info = getSpecifiedStats(Arrays.asList(specifiedGcId), type, fieldsName, true).get(specifiedGcId);
if (info == null) {
System.out.println(log);
throw new RuntimeException("Cannot find PLAB statistics in log ( GC_ID=" + specifiedGcId + " type=" + type + " )");
}
return info;
}
/**

@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import jdk.test.lib.OutputAnalyzer;
import jdk.test.lib.Utils;
/**
@ -50,7 +51,7 @@ public class PLABUtils {
* GC logging options list.
*/
private final static String G1_PLAB_LOGGING_OPTIONS[] = {
"-Xlog:gc=debug,gc+plab=debug"
"-Xlog:gc=debug,gc+plab=debug,gc+heap=debug"
};
/**
@ -81,4 +82,18 @@ public class PLABUtils {
executionOtions.addAll(options);
return executionOtions;
}
/**
* Common check for test PLAB application's results.
* @param out OutputAnalyzer for checking
* @throws RuntimeException
*/
public static void commonCheck(OutputAnalyzer out) throws RuntimeException {
if (out.getExitValue() != 0) {
System.out.println(out.getOutput());
throw new RuntimeException("Exit code is not 0");
}
// Test expects only WhiteBox initiated GC.
out.shouldNotContain("Pause Young (G1 Evacuation Pause)");
}
}