]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
ftests/utils: add get_distro() to detect Linux distribution
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Thu, 5 Jun 2025 15:36:26 +0000 (21:06 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 16 Jun 2025 14:01:39 +0000 (08:01 -0600)
Introduce helper function get_distro() to identify the current Linux
distribution. Currently checks for 'Ubuntu' and 'Oracle Linux', which
are the only distros used for testing. Can be extended to support others
in the future.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
tests/ftests/utils.py

index 6dedfd9091de6f4691f4e5e76383e4757722e12d..c52678635bb9ca2d306c4dbbab30bb971edbc811 100644 (file)
@@ -104,4 +104,13 @@ def is_output_same(config, out, expected_out):
     return result, cause
 
 
+# get the current linux flavour
+def get_distro(config):
+    with open('/etc/os-release', 'r') as relfile:
+        buf = relfile.read()
+        if "Oracle Linux" in buf:
+            return "oracle"
+        elif "Ubuntu" in buf:
+            return "ubuntu"
+
 # vim: set et ts=4 sw=4: