add check_glibc_ver function to autotest_utils.py

From: Michal Piotrowski <[email protected]>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@333 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/bin/autotest_utils.py b/bin/autotest_utils.py
index 5730aa3..ce960a3 100755
--- a/bin/autotest_utils.py
+++ b/bin/autotest_utils.py
@@ -402,3 +402,16 @@
 		if line.startswith('processor'):
 			cpus.append(line.split()[2]) # grab cpu number
 	return cpus
+
+
+def check_glibc_ver(ver):
+	glibc_ver = commands.getoutput('ldd --version').splitlines()[0]
+	glibc_ver = re.search(r'(\d+\.\d+\.\d+)', glibc_ver).group()
+	glibc_ver = glibc_ver.split('.')
+	ver2 = ver.split('.')
+
+	size = min(len(glibc_ver), len(ver2))
+	for i in range(size):
+		if glibc_ver[i] < ver2[i]:
+			print "Glibc is too old. Glibc >= " + ver + " is needed"
+			return -1