harness_simple.py revision 12b45582c04b2417036a6f11afc843ac5fddea50
1"""
2The simple harness interface
3"""
4
5__author__ = """Copyright Andy Whitcroft, Martin J. Bligh 2006"""
6
7import os, harness, time
8
9class harness_simple(harness.harness):
10    """
11    The simple 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        """
23        self.setup(job)
24
25        self.status = os.fdopen(3, 'w')
26
27
28    def test_status(self, status, tag):
29        """A test within this job is completing"""
30        if self.status:
31            for line in status.split('\n'):
32                # prepend status messages with
33                # AUTOTEST_STATUS:tag: so that we can tell
34                # which lines were sent by the autotest client
35                pre = 'AUTOTEST_STATUS:%s:' % (tag,)
36                self.status.write(pre + line + '\n')
37                self.status.flush()
38