ltp.py revision 0d022e761fef3a3d871a642bc56af9dbbdf7c54f
1import os 2from autotest_lib.client.bin import autotest_utils, test 3from autotest_lib.client.common_lib import utils, error 4 5class ltp(test.test): 6 version = 4 7 8 def initialize(self): 9 self.job.require_gcc() 10 11 12 # http://prdownloads.sourceforge.net/ltp/ltp-full-20080229.tgz 13 def setup(self, tarball = 'ltp-full-20080229.tar.bz2'): 14 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) 15 autotest_utils.extract_tarball_to_dir(tarball, self.srcdir) 16 os.chdir(self.srcdir) 17 18 utils.system('patch -p1 < ../ltp.patch') 19 20 # comment the capability tests if we fail to load the capability module 21 try: 22 utils.system('modprobe capability') 23 except error.CmdError, detail: 24 utils.system('patch -p1 < ../ltp_capability.patch') 25 26 utils.system('cp ../scan.c pan/') # saves having lex installed 27 utils.system('make -j %d' % autotest_utils.count_cpus()) 28 utils.system('yes n | make install') 29 30 31 # Note: to run a specific test, try '-f cmdfile -s test' in the 32 # in the args (-f for test file and -s for the test case) 33 # eg, job.run_test('ltp', '-f math -s float_bessel') 34 def run_once(self, args = '', script = 'runltp'): 35 36 # In case the user wants to run another test script 37 if script == 'runltp': 38 logfile = os.path.join(self.resultsdir, 'ltp.log') 39 failcmdfile = os.path.join(self.debugdir, 'failcmdfile') 40 args2 = '-q -l %s -C %s -d %s' % (logfile, failcmdfile, self.tmpdir) 41 args = args + ' ' + args2 42 43 cmd = os.path.join(self.srcdir, script) + ' ' + args 44 utils.system(cmd) 45