From 4a7d797fdaaf55d872b7c549f080a56f067a0224 Mon Sep 17 00:00:00 2001 From: Sangheon Kim Date: Mon, 4 Jun 2018 21:19:15 -0700 Subject: [PATCH] 8204095: [TESTBUG] TestPrintReferences.java fails if multiple concurrent mark happens Reviewed-by: kbarrett, tschatzl --- .../jtreg/gc/logging/TestPrintReferences.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/gc/logging/TestPrintReferences.java b/test/hotspot/jtreg/gc/logging/TestPrintReferences.java index 35c780669fb..c25dec659d6 100644 --- a/test/hotspot/jtreg/gc/logging/TestPrintReferences.java +++ b/test/hotspot/jtreg/gc/logging/TestPrintReferences.java @@ -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 class TestPrintReferences { 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);