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 | |
| 8 | from autotest_utils import * |
| 9 | import os, sys |
| 10 | |
| 11 | class harness: |
| 12 | """The NULL server harness |
| 13 | |
| 14 | Properties: |
| 15 | job |
| 16 | The job object for this job |
| 17 | """ |
| 18 | |
| 19 | def __init__(self, job): |
| 20 | """ |
| 21 | job |
| 22 | The job object for this job |
| 23 | """ |
apw | 4726b09 | 2007-03-12 20:35:05 +0000 | [diff] [blame] | 24 | self.setup(job) |
| 25 | |
| 26 | |
| 27 | def setup(self, job): |
| 28 | """ |
| 29 | job |
| 30 | The job object for this job |
| 31 | """ |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 32 | self.job = job |
| 33 | |
apw | 66cc4f6 | 2007-03-12 20:37:30 +0000 | [diff] [blame^] | 34 | configd = os.path.join(os.environ['AUTODIR'], 'configs') |
| 35 | if os.path.isdir(configd): |
| 36 | (name, dirs, files) = os.walk(configd).next() |
| 37 | job.config_set('kernel.default_config_set', |
| 38 | [ configd + '/' ] + files) |
| 39 | |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 40 | |
| 41 | def run_start(self): |
| 42 | """A run within this job is starting""" |
| 43 | pass |
| 44 | |
| 45 | |
| 46 | def run_pause(self): |
| 47 | """A run within this job is completing (expect continue)""" |
| 48 | pass |
| 49 | |
| 50 | |
| 51 | def run_reboot(self): |
| 52 | """A run within this job is performing a reboot |
| 53 | (expect continue following reboot) |
| 54 | """ |
| 55 | pass |
| 56 | |
| 57 | |
mbligh | 61a6c1a | 2006-12-25 01:26:38 +0000 | [diff] [blame] | 58 | def run_abort(self): |
| 59 | """A run within this job is aborting. It all went wrong""" |
| 60 | pass |
| 61 | |
| 62 | |
| 63 | def run_complete(self): |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 64 | """A run within this job is completing (all done)""" |
| 65 | pass |
| 66 | |
| 67 | |
| 68 | def test_status(self, status): |
| 69 | """A test within this job is completing""" |
| 70 | pass |
| 71 | |
| 72 | |
| 73 | def select(which, job): |
| 74 | if which: |
| 75 | exec "import harness_%s" % (which) |
| 76 | exec "myharness = harness_%s.harness_%s(job)" % (which, which) |
| 77 | else: |
| 78 | myharness = harness(job) |
| 79 | |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 80 | return myharness |