ltp.py revision a7cf728d545f422c84e219cc56b91bdc99684d1f
1import test
2import os
3from autotest_utils import *
4
5class ltp(test.test):
6	version = 3
7
8	# http://prdownloads.sourceforge.net/ltp/ltp-full-20070731.tgz
9	def setup(self, tarball = 'ltp-full-20070731.tar.bz2'):
10		tarball = unmap_url(self.bindir, tarball, self.tmpdir)
11		extract_tarball_to_dir(tarball, self.srcdir)
12		os.chdir(self.srcdir)
13
14		system('patch -p1 < ../ltp.patch')
15		system('cp ../scan.c pan/')   # saves having lex installed
16		system('make -j %d' % count_cpus())
17		system('yes n | make install')
18
19
20	# Note: to run a specific test, try '-f cmdfile -s test' in the
21	# in the args (-f for test file and -s for the test case)
22	# eg, job.run_test('ltp', '-f math -s float_bessel')
23	def execute(self, args = '', script = 'runltp'):
24
25		# In case the user wants to run another test script
26		if script == 'runltp':
27			logfile = os.path.join(self.resultsdir, 'ltp.log')
28			failcmdfile = os.path.join(self.debugdir, 'failcmdfile')
29			args2 = '-q -l %s -C %s -d %s' % (logfile, failcmdfile, self.tmpdir)
30			args = args + ' ' + args2
31
32		cmd = os.path.join(self.srcdir, script) + ' ' + args
33
34		profilers = self.job.profilers
35		if profilers.present():
36			profilers.start(self)
37		system(cmd)
38		if profilers.present():
39			profilers.stop(self)
40			profilers.report(self)
41