apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 1 | """The harness interface |
| 2 | |
| 3 | The interface between the client and the server when hosted. |
| 4 | """ |
| 5 | |
| 6 | __author__ = """Copyright Andy Whitcroft 2006""" |
| 7 | |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 8 | import os, sys |
| 9 | |
| 10 | class 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 | """ |
apw | 4726b09 | 2007-03-12 20:35:05 +0000 | [diff] [blame] | 23 | self.setup(job) |
| 24 | |
| 25 | |
| 26 | def setup(self, job): |
| 27 | """ |
| 28 | job |
| 29 | The job object for this job |
| 30 | """ |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 31 | self.job = job |
| 32 | |
apw | 66cc4f6 | 2007-03-12 20:37:30 +0000 | [diff] [blame] | 33 | 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 | |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 39 | |
| 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 | |
mbligh | 61a6c1a | 2006-12-25 01:26:38 +0000 | [diff] [blame] | 57 | 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): |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 63 | """A run within this job is completing (all done)""" |
| 64 | pass |
| 65 | |
| 66 | |
mbligh | d528d30 | 2007-12-19 16:19:05 +0000 | [diff] [blame] | 67 | def test_status(self, status, tag): |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 68 | """A test within this job is completing""" |
| 69 | pass |
| 70 | |
| 71 | |
mbligh | d528d30 | 2007-12-19 16:19:05 +0000 | [diff] [blame] | 72 | def test_status_detail(self, code, subdir, operation, status, tag): |
apw | 4b2e4fb | 2007-09-25 16:52:30 +0000 | [diff] [blame] | 73 | """A test within this job is completing (detail)""" |
| 74 | pass |
| 75 | |
| 76 | |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 77 | def select(which, job): |
mbligh | 362ab3d | 2007-08-30 11:24:04 +0000 | [diff] [blame] | 78 | if not which: |
| 79 | which = 'standalone' |
| 80 | |
| 81 | exec "import harness_%s" % (which) |
| 82 | exec "myharness = harness_%s.harness_%s(job)" % (which, which) |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 83 | |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 84 | return myharness |