From 615efc7b7dba86eb81750eb9cdc7b4c1e6594bbb Mon Sep 17 00:00:00 2001 From: Kamalesh Babulal Date: Thu, 5 Jun 2025 21:06:26 +0530 Subject: [PATCH] ftests/utils: add get_distro() to detect Linux distribution 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 Signed-off-by: Tom Hromatka --- tests/ftests/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/ftests/utils.py b/tests/ftests/utils.py index 6dedfd90..c5267863 100644 --- a/tests/ftests/utils.py +++ b/tests/ftests/utils.py @@ -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: -- 2.47.2