8204095: [TESTBUG] TestPrintReferences.java fails if multiple concurrent mark happens
authorsangheki
Mon, 04 Jun 2018 21:19:15 -0700
changeset 50395 41258f041b24
parent 50394 89dc31d7572b
child 50396 7f48bff40a9a
8204095: [TESTBUG] TestPrintReferences.java fails if multiple concurrent mark happens Reviewed-by: kbarrett, tschatzl
test/hotspot/jtreg/gc/logging/TestPrintReferences.java
--- 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);