]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
ftests: Rename Test 001 to denote it is cgroup v1 only
authorTom Hromatka <tom.hromatka@oracle.com>
Tue, 3 Nov 2020 14:55:05 +0000 (07:55 -0700)
committerTom Hromatka <tom.hromatka@oracle.com>
Tue, 3 Nov 2020 15:00:43 +0000 (08:00 -0700)
Rename test 1 from 001-cgget-basic_cgget.py to
001-cgget-basic_cgget_v1.py.  Also add logic to the test
to skip it on a v2 system.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
ftests/001-cgget-basic_cgget_v1.py [moved from ftests/001-cgget-basic_cgget.py with 81% similarity]
ftests/Makefile.am

similarity index 81%
rename from ftests/001-cgget-basic_cgget.py
rename to ftests/001-cgget-basic_cgget_v1.py
index c8cd3fd68a7fe75e66bd64f2fb3a54e5f37bdd0f..87da4bc67725271774aae51195527eae48901e78 100755 (executable)
@@ -32,6 +32,17 @@ CGNAME="001cgget"
 SETTING='cpu.shares'
 VALUE='512'
 
+def prereqs(config):
+    result = consts.TEST_PASSED
+    cause = None
+
+    # This test was written for a cgroup v1 cpu controller only
+    if Cgroup.version('cpu') != Cgroup.CGROUP_V1:
+        result = consts.TEST_SKIPPED
+        cause = "This test requires the cgroup v1 cpu controller"
+
+    return result, cause
+
 def setup(config):
     Cgroup.create(config, CONTROLLER, CGNAME)
     Cgroup.set(config, CGNAME, SETTING, VALUE)
@@ -54,6 +65,10 @@ def teardown(config):
     Cgroup.delete(config, CONTROLLER, CGNAME)
 
 def main(config):
+    [result, cause] = prereqs(config)
+    if result != consts.TEST_PASSED:
+        return [result, cause]
+
     setup(config)
     [result, cause] = test(config)
     teardown(config)
index 68afb0e26a6013e20cd916eca415269d756a967c..acae5ac7d5accbc2b412bcb185d70481549a1bb7 100644 (file)
@@ -19,7 +19,7 @@
 # along with this library; if not, see <http://www.gnu.org/licenses>.
 #
 
-TESTS = 001-cgget-basic_cgget.py \
+TESTS = 001-cgget-basic_cgget_v1.py \
        002-cgdelete-recursive_delete.py
 
 EXTRA_DIST = *.py README.md default.conf