Hi Bob,

This fix seems quite reasonable.

Thanks,
David

On 8/05/2019 6:25 am, Bob Vandette wrote:
Please review this simple fix for a TestCgroupMetrics.java test failure.

--- a/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java
+++ b/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java
@@ -108,7 +108,7 @@
          try {
              List<String> lines = 
Files.readAllLines(Paths.get(subsystem.path(), param));
              for (String line: lines) {
-                if (line.contains(match)) {
+                if (line.startsWith(match)) {
                      retval = conversion.apply(line);
                      break;
                  }

Under docker we typically only see a single block I/O device so
the test passed since both lines containing “Total” are the same value.

8:16 Read 4452352
8:16 Write 0
8:16 Sync 0
8:16 Async 4452352
8:16 Total 4452352
Total 4452352

It’s possible and likely that there will be multiple devices causing failures
since the test and the Metrics API are not examining the same lines.

249:0 Read 10477568
249:0 Write 294431895552
249:0 Sync 17292476416
249:0 Async 277149896704
249:0 Total 294442373120 <——— The API was returning this
8:16 Read 19017216
8:16 Write 326780178432
8:16 Sync 17398915072
8:16 Async 309400280576
8:16 Total 326799195648
8:0 Read 27092992
8:0 Write 31070281728
8:0 Sync 10728873984
8:0 Async 20368500736
8:0 Total 31097374720
Total 652338943488 <—— Test test was comparing to this

We are after the line that “startsWith” “Total”.

Bob.

Reply via email to