Skip to content

Commit f1c5041

Browse files
committed
8374200: jdk/internal/platform/cgroup/TestCgroupMetrics.java fails with common prefix metrics
Reviewed-by: dholmes
1 parent 40755af commit f1c5041

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/lib/jdk/test/lib/containers/cgroup/MetricsTesterCgroupV2.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ private long getLongValueFromFile(String file) {
121121
private long getLongValueEntryFromFile(String file, String metric) {
122122
Path filePath = Paths.get(UNIFIED.getPath(), file);
123123
try {
124-
String strVal = Files.lines(filePath).filter(l -> l.startsWith(metric)).collect(Collectors.joining());
124+
String strVal = Files.lines(filePath)
125+
.filter(l -> l.matches("^" + metric + "\\s+.*")).collect(Collectors.joining());
125126
if (strVal.isEmpty()) {
126127
// sometimes the match for the metric does not exist, e.g. cpu.stat's nr_periods iff the controller
127128
// is not enabled

0 commit comments

Comments
 (0)