8204095: [TESTBUG] TestPrintReferences.java fails if multiple concurrent mark happens
Reviewed-by: kbarrett, tschatzl
--- a/test/hotspot/jtreg/gc/logging/TestPrintReferences.java Tue Jun 05 08:10:08 2018 +0530
+++ b/test/hotspot/jtreg/gc/logging/TestPrintReferences.java Mon Jun 04 21:19:15 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -177,6 +177,24 @@
public static void checkLogValue(OutputAnalyzer out) {
output = out.getStdout();
+ String patternString = gcLogTimeRegex + indent(0) +
+ referenceProcessing + ": " + "[0-9]+[.,][0-9]+";
+ Matcher m = Pattern.compile(patternString).matcher(output);
+ if (m.find()) {
+ int start = m.start();
+ int end = output.length();
+ // If there's another concurrent Reference Processing log, ignore it.
+ if (m.find()) {
+ end = m.start();
+ }
+ if (start != -1) {
+ output = output.substring(start, end);
+ checkTrimmedLogValue();
+ }
+ }
+ }
+
+ public static void checkTrimmedLogValue() {
BigDecimal refProcTime = getTimeValue(referenceProcessing, 0);
BigDecimal sumOfSubPhasesTime = checkPhaseTime(softReference);