changeset 50999:41258f041b24

8204095: [TESTBUG] TestPrintReferences.java fails if multiple concurrent mark happens Reviewed-by: kbarrett, tschatzl
author sangheki
date Mon, 04 Jun 2018 21:19:15 -0700
parents 89dc31d7572b
children 7f48bff40a9a
files test/hotspot/jtreg/gc/logging/TestPrintReferences.java
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);