8221340: [TESTBUG] TestCgroupMetrics.java fails after fix for JDK-8219562

Reviewed-by: mseledtsov, rriggs
This commit is contained in:
Bob Vandette 2019-05-10 11:15:34 -04:00
parent 8de6f58988
commit 11d3a2ce35
2 changed files with 6 additions and 6 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -61,7 +61,7 @@ public class SubSystem {
path = mountPoint; path = mountPoint;
} }
else { else {
if (root.indexOf(cgroupPath) == 0) { if (cgroupPath.startsWith(root)) {
if (cgroupPath.length() > root.length()) { if (cgroupPath.length() > root.length()) {
String cgroupSubstr = cgroupPath.substring(root.length()); String cgroupSubstr = cgroupPath.substring(root.length());
path = mountPoint + cgroupSubstr; path = mountPoint + cgroupSubstr;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -85,7 +85,7 @@ public class MetricsTester {
String mountPoint = paths[1]; String mountPoint = paths[1];
if (root != null && cgroupPath != null) { if (root != null && cgroupPath != null) {
if (root.equals("/")) { if (root.equals("/")) {
if (cgroupPath.equals("/")) { if (!cgroupPath.equals("/")) {
finalPath = mountPoint + cgroupPath; finalPath = mountPoint + cgroupPath;
} else { } else {
finalPath = mountPoint; finalPath = mountPoint;
@ -94,7 +94,7 @@ public class MetricsTester {
if (root.equals(cgroupPath)) { if (root.equals(cgroupPath)) {
finalPath = mountPoint; finalPath = mountPoint;
} else { } else {
if (root.indexOf(cgroupPath) == 0) { if (cgroupPath.startsWith(root)) {
if (cgroupPath.length() > root.length()) { if (cgroupPath.length() > root.length()) {
String cgroupSubstr = cgroupPath.substring(root.length()); String cgroupSubstr = cgroupPath.substring(root.length());
finalPath = mountPoint + cgroupSubstr; finalPath = mountPoint + cgroupSubstr;
@ -103,7 +103,7 @@ public class MetricsTester {
} }
} }
} }
subSystemPaths.put(subSystem, new String[]{finalPath}); subSystemPaths.put(subSystem, new String[]{finalPath, mountPoint});
} }
} }
} }