Skip to content

Commit cbe82ca

Browse files
committed
8374200: jdk/internal/platform/cgroup/TestCgroupMetrics.java fails with common prefix metrics
1 parent 9715e6d commit cbe82ca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ 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.startsWith(metric))
126+
.filter(l -> l.split("\\s+")[0].equals(metric))
127+
.collect(Collectors.joining());
125128
if (strVal.isEmpty()) {
126129
// sometimes the match for the metric does not exist, e.g. cpu.stat's nr_periods iff the controller
127130
// is not enabled

0 commit comments

Comments
 (0)