blob: 2a6378f0ab386750327f1843b3ef5ff6bc21bacf [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
10class harness:
11 """The NULL server harness
12
13 Properties:
14 job
15 The job object for this job
16 """
17
18 def __init__(self, job):
19 """
20 job
21 The job object for this job
22 """
apw4726b092007-03-12 20:35:05 +000023 self.setup(job)
24
25
26 def setup(self, job):
27 """
28 job
29 The job object for this job
30 """
apwde1503a2006-10-10 08:34:21 +000031 self.job = job
32
apw66cc4f62007-03-12 20:37:30 +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',
37 [ configd + '/' ] + files)
38
apwde1503a2006-10-10 08:34:21 +000039
40 def run_start(self):
41 """A run within this job is starting"""
42 pass
43
44
45 def run_pause(self):
46 """A run within this job is completing (expect continue)"""
47 pass
48
49
50 def run_reboot(self):
51 """A run within this job is performing a reboot
52 (expect continue following reboot)
53 """
54 pass
55
56
mbligh61a6c1a2006-12-25 01:26:38 +000057 def run_abort(self):
58 """A run within this job is aborting. It all went wrong"""
59 pass
60
61
62 def run_complete(self):
apwde1503a2006-10-10 08:34:21 +000063 """A run within this job is completing (all done)"""
64 pass
65
66
mblighd528d302007-12-19 16:19:05 +000067 def test_status(self, status, tag):
apwde1503a2006-10-10 08:34:21 +000068 """A test within this job is completing"""
69 pass
70
71
mblighd528d302007-12-19 16:19:05 +000072 def test_status_detail(self, code, subdir, operation, status, tag):
apw4b2e4fb2007-09-25 16:52:30 +000073 """A test within this job is completing (detail)"""
74 pass
75
76
apwde1503a2006-10-10 08:34:21 +000077def select(which, job):
mbligh362ab3d2007-08-30 11:24:04 +000078 if not which:
79 which = 'standalone'
80
81 exec "import harness_%s" % (which)
82 exec "myharness = harness_%s.harness_%s(job)" % (which, which)
apwde1503a2006-10-10 08:34:21 +000083
apwde1503a2006-10-10 08:34:21 +000084 return myharness