Add a get_cpu_family check, and a hook for site-specific utils
From: Jiqing Tang <[email protected]>
Signed-off-by: Martin Bligh <[email protected]>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@969 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/bin/autotest_utils.py b/client/bin/autotest_utils.py
index b01bc83..24e6b27 100755
--- a/client/bin/autotest_utils.py
+++ b/client/bin/autotest_utils.py
@@ -541,3 +541,20 @@
# Find free space available in bytes
s = os.statvfs(path)
return s[statvfs.F_BAVAIL] * long(s[statvfs.F_BSIZE])
+
+
+def get_cpu_family():
+ procinfo = system_output('cat /proc/cpuinfo')
+ CPU_FAMILY_RE = re.compile(r'^cpu family\s+:\s+(\S+)', re.M)
+ matches = CPU_FAMILY_RE.findall(procinfo)
+ if matches:
+ return int(matches[0])
+ else:
+ raise TestError('Could not get valid cpu family data')
+
+
+try:
+ from site_utils import *
+except ImportError:
+ pass
+