test.py revision 0e6192aa2853fb4dd98cbad705471b3fb135e70e
1# Copyright Martin J. Bligh, Andy Whitcroft, 2006 2# 3# Shell class for a test, inherited by all individual tests 4# 5# Methods: 6# __init__ initialise 7# initialize run once for each job 8# setup run once for each new version of the test installed 9# run run the test (wrapped by job.run_test()) 10# 11# Data: 12# job backreference to the job this test instance is part of 13# outputdir eg. results/<job>/<testname.tag> 14# resultsdir eg. results/<job>/<testname.tag>/results 15# profdir eg. results/<job>/<testname.tag>/profiling 16# debugdir eg. results/<job>/<testname.tag>/debug 17# bindir eg. tests/<test> 18# src eg. tests/<test>/src 19# tmpdir eg. tmp/<testname.tag> 20 21import os, traceback 22 23from autotest_lib.client.common_lib import error, utils, test 24from autotest_lib.client.bin import sysinfo 25 26 27class test(common.test.base_test): 28 pass 29 30 31testname = common.test.testname 32 33 34def _grab_sysinfo(mytest): 35 try: 36 sysinfo_dir = os.path.join(mytest.outputdir, 'sysinfo') 37 sysinfo.log_after_each_test(sysinfo_dir, mytest.job.sysinfodir) 38 if os.path.exists(mytest.tmpdir): 39 utils.system('rm -rf ' + mytest.tmpdir) 40 except: 41 print 'after-test error:' 42 traceback.print_exc(file=sys.stdout) 43 44def runtest(job, url, tag, args, dargs): 45 common.test.runtest(job, url, tag, args, dargs, 46 locals(), globals(), _grab_sysinfo) 47