add check_kernel_ver to autotest_utils
From: Michal Piotrowski <[email protected]>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@545 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/bin/autotest_utils.py b/client/bin/autotest_utils.py
index 265c9df..b61fe21 100755
--- a/client/bin/autotest_utils.py
+++ b/client/bin/autotest_utils.py
@@ -450,8 +450,16 @@
glibc_ver = commands.getoutput('ldd --version').splitlines()[0]
glibc_ver = re.search(r'(\d+\.\d+(\.\d+)?)', glibc_ver).group()
if glibc_ver.split('.') < ver.split('.'):
- raise "Glibc is too old (%s). Glibc >= %s is needed." % \
- (glibc_ver, ver)
+ raise TestError("Glibc is too old (%s). Glibc >= %s is needed." % \
+ (glibc_ver, ver))
+
+def check_kernel_ver(ver):
+ kernel_ver = system_output('uname -r')
+ kv_tmp = re.split(r'[-]', kernel_ver)[0:3]
+ if kv_tmp[0].split('.') < ver.split('.'):
+ raise TestError("Kernel is too old (%s). Kernel > %s is needed." % \
+ (kernel_ver, ver))
+
def read_one_line(filename):
return open(filename, 'r').readline().strip()