]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tests: Ignore cpuset exclusive errors in test 038
authorTom Hromatka <tom.hromatka@oracle.com>
Fri, 18 Mar 2022 15:41:20 +0000 (09:41 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 23 Mar 2022 15:13:33 +0000 (09:13 -0600)
Setting the cpuset exclusive can be challenging because other
cgroups could be using the cpu that is slated to become exclusive
to this cgroup.  Add try/except handling to test 038 for when we
can't get the exclusive bit set, so that the test doesn't fail due
to circumstances beyond libcgroup's control.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
ftests/038-cgxget-cpuset_settings.py

index 720e179181110dd3dc58d26d33c81495b665d078..b376ecbe2c354eb17295d89b99ccec634a89f827 100755 (executable)
@@ -8,7 +8,7 @@
 #
 
 from cgroup import Cgroup, CgroupVersion
-from run import Run
+from run import Run, RunError
 import consts
 import ftests
 import sys
@@ -94,8 +94,15 @@ def test(config):
     cause = None
 
     for entry in TABLE:
-        Cgroup.xset(config, cgname=CGNAME, setting=entry[0], value=entry[1],
-                    version=entry[2])
+        try:
+            Cgroup.xset(config, cgname=CGNAME, setting=entry[0],
+                        value=entry[1], version=entry[2])
+        except RunError as re:
+            if re.stderr.find('Invalid argument') >= 0:
+                # The kernel disallowed this setting, likely due to the many
+                # complexities of exclusive cpusets
+                continue
+            raise re
 
         out = Cgroup.xget(config, cgname=CGNAME, setting=entry[3],
                           version=entry[5], values_only=True,