8157452: [TESTBUG] PLAB tests don't handle unexpected GC
Reviewed-by: dfazunen, tschatzl
--- a/hotspot/test/gc/g1/plab/TestPLABPromotion.java Fri May 27 19:43:58 2016 +0000
+++ b/hotspot/test/gc/g1/plab/TestPLABPromotion.java Fri May 27 17:48:56 2016 +0300
@@ -122,10 +122,7 @@
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);
}
--- a/hotspot/test/gc/g1/plab/TestPLABResize.java Fri May 27 19:43:58 2016 +0000
+++ b/hotspot/test/gc/g1/plab/TestPLABResize.java Fri May 27 17:48:56 2016 +0300
@@ -94,10 +94,7 @@
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 @@
// 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);
--- a/hotspot/test/gc/g1/plab/lib/LogParser.java Fri May 27 19:43:58 2016 +0000
+++ b/hotspot/test/gc/g1/plab/lib/LogParser.java Fri May 27 17:48:56 2016 +0300
@@ -169,7 +169,12 @@
* @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;
}
/**
--- a/hotspot/test/gc/g1/plab/lib/PLABUtils.java Fri May 27 19:43:58 2016 +0000
+++ b/hotspot/test/gc/g1/plab/lib/PLABUtils.java Fri May 27 17:48:56 2016 +0300
@@ -26,6 +26,7 @@
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 @@
* 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 @@
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)");
+ }
}