harness_simple.py revision 7942d39e39a12340de2b2dd1db33d0459af0c17f
1""" 2The simple harness interface 3""" 4 5__author__ = """Copyright Andy Whitcroft, Martin J. Bligh 2006""" 6 7from autotest_utils import * 8import os, harness, time 9 10class harness_simple(harness.harness): 11 """ 12 The simple 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 """ 24 self.setup(job) 25 26 self.status = os.fdopen(3, 'w') 27 28 29 def __send(self, msg): 30 if self.status: 31 self.status.write(msg.rstrip() + "\n") 32 self.status.flush() 33 34 35 def run_start(self): 36 """A run within this job is starting""" 37 self.__send("STATUS\tGOOD\t----\trun starting") 38 39 40 def run_reboot(self): 41 """A run within this job is performing a reboot 42 (expect continue following reboot) 43 """ 44 self.__send("REBOOT") 45 46 47 def run_complete(self): 48 """A run within this job is completing (all done)""" 49 self.__send("DONE") 50 51 52 def test_status(self, status): 53 """A test within this job is completing""" 54 55 # Send the first line with the status code as a STATUS message. 56 lines = status.split("\n") 57 self.__send("STATUS\t" + lines[0]) 58