• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""The harness interface
2
3The interface between the client and the server when hosted.
4"""
5
6# pylint: disable=missing-docstring
7
8__author__ = """Copyright Andy Whitcroft 2006"""
9
10import logging
11
12import common
13
14
15class harness(object):
16    """The NULL server harness
17
18    Properties:
19            job
20                    The job object for this job
21    """
22
23    def __init__(self, job):
24        """
25                job
26                        The job object for this job
27        """
28        self.setup(job)
29
30
31    def setup(self, job):
32        """
33                job
34                        The job object for this job
35        """
36        self.job = job
37
38
39    def run_start(self):
40        """A run within this job is starting"""
41        pass
42
43
44    def run_pause(self):
45        """A run within this job is completing (expect continue)"""
46        pass
47
48
49    def run_reboot(self):
50        """A run within this job is performing a reboot
51           (expect continue following reboot)
52        """
53        pass
54
55
56    def run_abort(self):
57        """A run within this job is aborting. It all went wrong"""
58        pass
59
60
61    def run_complete(self):
62        """A run within this job is completing (all done)"""
63        pass
64
65
66    def run_test_complete(self):
67        """A test run by this job is complete. Note that if multiple
68        tests are run in parallel, this will only be called when all
69        of the parallel runs complete."""
70        pass
71
72
73    def test_status(self, status, tag):
74        """A test within this job is completing"""
75        pass
76
77
78    def test_status_detail(self, code, subdir, operation, status, tag,
79                           optional_fields):
80        """A test within this job is completing (detail)"""
81        pass
82
83
84def select(which, job, harness_args):
85    if not which:
86        which = 'standalone'
87
88    logging.debug('Selected harness: %s', which)
89
90    harness_name = 'harness_%s' % which
91    harness_module = common.setup_modules.import_module(harness_name,
92                                                        'autotest_lib.client.bin')
93    harness_instance = getattr(harness_module, harness_name)(job, harness_args)
94
95    return harness_instance
96