From: Kamalesh Babulal Date: Tue, 28 May 2024 09:50:35 +0000 (+0530) Subject: ftests/061: Fix the expected line in cpu controller X-Git-Tag: v3.2.0~115 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d1df9ae3a371bbbac7121a1932e1c9837b63f432;p=thirdparty%2Flibcgroup.git ftests/061: Fix the expected line in cpu controller Cgroup cpu controller output might be less than 10 lines in older Kernel version <= 5.4, fix it by adjusting the expected outline count after reading the current kernel's version. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/tests/ftests/061-sudo-g_flag_controller_only_systemd-v1.py b/tests/ftests/061-sudo-g_flag_controller_only_systemd-v1.py index 5e1818f3..d6c16eb3 100755 --- a/tests/ftests/061-sudo-g_flag_controller_only_systemd-v1.py +++ b/tests/ftests/061-sudo-g_flag_controller_only_systemd-v1.py @@ -12,6 +12,7 @@ from systemd import Systemd from run import RunError import consts import ftests +import utils import sys import os @@ -77,8 +78,13 @@ def test(config): result = consts.TEST_PASSED cause = None + expected_out_len = 10 + kernel_ver = utils.get_kernel_version(config) + if int(kernel_ver[0]) <= 5 and int(kernel_ver[1]) <= 4: + expected_out_len = 8 + out = Cgroup.get(config, controller=CONTROLLER, cgname=SYSTEMD_CGNAME) - if len(out.splitlines()) < 10: + if len(out.splitlines()) < expected_out_len: # This cgget command gets all of the settings/values within the cgroup. # We don't care about the exact data, but there should be at least 10 # lines of settings/values @@ -89,7 +95,7 @@ def test(config): ) out = Cgroup.get(config, controller=CONTROLLER, cgname=OTHER_CGNAME, ignore_systemd=True) - if len(out.splitlines()) < 10: + if len(out.splitlines()) < expected_out_len: result = consts.TEST_FAILED tmp_cause = ( 'cgget failed to read at least 10 lines from '