From: Kamalesh Babulal Date: Sat, 25 May 2024 09:30:05 +0000 (+0530) Subject: ftests/cgroup: Add function to return kernel version X-Git-Tag: v3.2.0~116 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa345bbe1d458c1e37832f815c9a3c3ffc79224c;p=thirdparty%2Flibcgroup.git ftests/cgroup: Add function to return kernel version Add function to return the Major, Minor and Patch level of the current booted kernel. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka TJH: Moved function from CgroupVersion class to utils.py --- diff --git a/tests/ftests/utils.py b/tests/ftests/utils.py index a0fb6ee4..027fa352 100644 --- a/tests/ftests/utils.py +++ b/tests/ftests/utils.py @@ -7,6 +7,7 @@ # from run import Run +import platform # function to indent a block of text by cnt number of spaces @@ -79,4 +80,10 @@ def get_file_permissions(config, filename): else: return Run.run(cmd, shell_bool=True) +# get the current kernel version +def get_kernel_version(config): + kernel_version_str = str(platform.release()) + kernel_version = kernel_version_str.split('.')[0:3] + return kernel_version + # vim: set et ts=4 sw=4: