CI: use native Python functions to detect system and release
authorRalph Boehme <slow@samba.org>
Wed, 2 Mar 2022 15:10:28 +0000 (16:10 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 28 Apr 2022 13:12:33 +0000 (13:12 +0000)
This ensures we detect the runtime system and release, not the ones
when Samba was build. It's necessary to detect the correct kernel
version we're running on because for kernels before 5.3.1 O_PATH opens
unnecessarily broke kernel oplocks, which breaks our tests. And in
gitlab it can happen that we build on kernels after 5.3.1 and later
run on older kernels. In this situation we can't run kernel oplock
tests.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/selftest/tests.py

index bddc26a95db75ac152d59b250d5e308addd66c0a..a43889b5964aeba3981dccd77d27085d64d7d15a 100755 (executable)
@@ -21,6 +21,7 @@
 import os
 import sys
 import re
+import platform
 sys.path.insert(0, os.path.normpath(os.path.join(os.path.dirname(__file__), "../../selftest")))
 import selftesthelpers
 from selftesthelpers import bindir, srcdir, scriptdir, binpath
@@ -75,8 +76,9 @@ try:
 finally:
     f.close()
 
-if config_hash["SYSTEM_UNAME_SYSNAME"] == '"Linux"':
-    m = re.search(r'(\d+).(\d+).(\d+)', config_hash["SYSTEM_UNAME_RELEASE"])
+linux_kernel_version = None
+if platform.system() == 'Linux':
+    m = re.search(r'(\d+).(\d+).(\d+)', platform.release())
     if m:
         linux_kernel_version = [int(m.group(1)), int(m.group(2)), int(m.group(3))]