summaryrefslogtreecommitdiff
path: root/client/bin/test.py
blob: 78dbdd1aeeadbd5579ed571db752d9f03c31c8e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copyright Martin J. Bligh, Andy Whitcroft, 2006
#
# Shell class for a test, inherited by all individual tests
#
# Methods:
#	__init__	initialise
#	initialize	run once for each job
#	setup		run once for each new version of the test installed
#	run		run the test (wrapped by job.run_test())
#
# Data:
#	job		backreference to the job this test instance is part of
#	outputdir	eg. results/<job>/<testname.tag>
#	resultsdir	eg. results/<job>/<testname.tag>/results
#	profdir		eg. results/<job>/<testname.tag>/profiling
#	debugdir	eg. results/<job>/<testname.tag>/debug
#	bindir		eg. tests/<test>
#	src		eg. tests/<test>/src
#	tmpdir		eg. tmp/<testname.tag>

import os, traceback

from autotest_lib.client.common_lib import error, utils
from autotest_lib.client.common_lib import test as common_test
from autotest_lib.client.bin import sysinfo


class test(common_test.base_test):
	pass


testname = common_test.testname


def _grab_sysinfo(mytest):
	try:
		sysinfo_dir = os.path.join(mytest.outputdir, 'sysinfo')
		sysinfo.log_after_each_test(sysinfo_dir, mytest.job.sysinfodir)
		if os.path.exists(mytest.tmpdir):
			utils.system('rm -rf ' + mytest.tmpdir)
	except:
		print 'after-test error:'
		traceback.print_exc(file=sys.stdout)


def runtest(job, url, tag, args, dargs):
	common_test.runtest(job, url, tag, args, dargs,
	                    locals(), globals(), _grab_sysinfo)