]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
ftests/038: fix cpuset_exclusive oddity
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 12 Apr 2024 10:18:45 +0000 (15:48 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 15 Apr 2024 19:20:54 +0000 (13:20 -0600)
With upstream commit 7476a636d3100 ("cgroup/cpuset: Show invalid
partition reason string"), doesn't return error but needs to be re-read
again. This oddity is seen in kernel >= 6.5, fix it by introducing some
checks for cpuset_exclusive oddity.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Apr 12 10:20:07
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                              Time (sec)
        --------------------------------------------
        setup                                   0.00
        038-cgxget-cpuset_settings.py          24.75
        teardown                                0.00
        --------------------------------------------
        Total Run Time                         24.75

Fixes: https://github.com/libcgroup/libcgroup/issues/423
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
tests/ftests/038-cgxget-cpuset_settings.py

index 8af6d874e5459193da90c8a5b281b88390611f94..575baf3b50d94e628c4c848a473e067214579912 100755 (executable)
@@ -88,6 +88,21 @@ def setup(config):
     Cgroup.create(config, CONTROLLER, CGNAME)
 
 
+def is_cpuset_exclusive_oddity(entry, out):
+    # upstream commit 7476a636d3100 ("cgroup/cpuset: Show invalid
+    # partition reason string"), doesn't return error but needs to be
+    # read again
+    if (entry[0] == 'cpuset.cpu_exclusive' and entry[1] == '1' and
+            (out == '0' or out[:12] == "root invalid")):
+        return True
+
+    if (entry[0] == 'cpuset.cpus.partition' and entry[1] == 'root' and
+            (out == '0' or out[:12] == 'root invalid')):
+        return True
+
+    return False
+
+
 def test(config):
     result = consts.TEST_PASSED
     cause = None
@@ -107,6 +122,9 @@ def test(config):
                           version=entry[5], values_only=True,
                           print_headers=False)
         if out != entry[4]:
+            if (is_cpuset_exclusive_oddity(entry, out)):
+                continue
+
             result = consts.TEST_FAILED
             cause = (
                         'After setting {}={}, expected {}={}, but received '