blob: 2cd0d3134239af96d767529c40e1a9f055f183b9 [file] [log] [blame]
apwde1503a2006-10-10 08:34:21 +00001"""The harness interface
2
3The interface between the client and the server when hosted.
4"""
5
6__author__ = """Copyright Andy Whitcroft 2006"""
7
apwde1503a2006-10-10 08:34:21 +00008import os, sys
9
mbligh6e83b6f2008-06-10 16:26:59 +000010class harness(object):
jadmanski0afbb632008-06-06 21:10:57 +000011 """The NULL server harness
apwde1503a2006-10-10 08:34:21 +000012
jadmanski0afbb632008-06-06 21:10:57 +000013 Properties:
14 job
15 The job object for this job
16 """
apwde1503a2006-10-10 08:34:21 +000017
jadmanski0afbb632008-06-06 21:10:57 +000018 def __init__(self, job):
19 """
20 job
21 The job object for this job
22 """
23 self.setup(job)
apw4726b092007-03-12 20:35:05 +000024
25
jadmanski0afbb632008-06-06 21:10:57 +000026 def setup(self, job):
27 """
28 job
29 The job object for this job
30 """
31 self.job = job
apwde1503a2006-10-10 08:34:21 +000032
jadmanski0afbb632008-06-06 21:10:57 +000033 configd = os.path.join(os.environ['AUTODIR'], 'configs')
34 if os.path.isdir(configd):
35 (name, dirs, files) = os.walk(configd).next()
36 job.config_set('kernel.default_config_set',
mbligh8b352852008-06-07 01:07:08 +000037 [ configd + '/' ] + files)
apw66cc4f62007-03-12 20:37:30 +000038
apwde1503a2006-10-10 08:34:21 +000039
jadmanski0afbb632008-06-06 21:10:57 +000040 def run_start(self):
41 """A run within this job is starting"""
42 pass
apwde1503a2006-10-10 08:34:21 +000043
44
jadmanski0afbb632008-06-06 21:10:57 +000045 def run_pause(self):
46 """A run within this job is completing (expect continue)"""
47 pass
apwde1503a2006-10-10 08:34:21 +000048
49
jadmanski0afbb632008-06-06 21:10:57 +000050 def run_reboot(self):
51 """A run within this job is performing a reboot
52 (expect continue following reboot)
53 """
54 pass
apwde1503a2006-10-10 08:34:21 +000055
56
jadmanski0afbb632008-06-06 21:10:57 +000057 def run_abort(self):
58 """A run within this job is aborting. It all went wrong"""
59 pass
mbligh61a6c1a2006-12-25 01:26:38 +000060
61
jadmanski0afbb632008-06-06 21:10:57 +000062 def run_complete(self):
63 """A run within this job is completing (all done)"""
64 pass
apwde1503a2006-10-10 08:34:21 +000065
66
jadmanski0afbb632008-06-06 21:10:57 +000067 def test_status(self, status, tag):
68 """A test within this job is completing"""
69 pass
apwde1503a2006-10-10 08:34:21 +000070
71
jadmanski0afbb632008-06-06 21:10:57 +000072 def test_status_detail(self, code, subdir, operation, status, tag):
73 """A test within this job is completing (detail)"""
74 pass
apw4b2e4fb2007-09-25 16:52:30 +000075
76
apwde1503a2006-10-10 08:34:21 +000077def select(which, job):
jadmanski0afbb632008-06-06 21:10:57 +000078 if not which:
79 which = 'standalone'
apwde1503a2006-10-10 08:34:21 +000080
jadmanski0afbb632008-06-06 21:10:57 +000081 exec "import harness_%s" % (which)
82 exec "myharness = harness_%s.harness_%s(job)" % (which, which)
83
84 return myharness