@@ -5,7 +5,7 @@ The interface between the client and the server when hosted.
__author__ = """Copyright Andy Whitcroft 2006"""
-import os, sys
+import os, sys, logging
import common
class harness(object):
@@ -86,6 +86,8 @@ def select(which, job):
if not which:
which = 'standalone'
+ logging.debug('Selected harness: %s' % which)
+
harness_name = 'harness_%s' % which
harness_module = common.setup_modules.import_module(harness_name,
'autotest_lib.client.bin')
@@ -174,7 +174,20 @@ class base_client_job(base_job.base_job):
self._next_step_index = 0
self._load_state()
- self.harness = harness.select(options.harness, self)
+ # harness is chosen by following rules:
+ # 1. explicitly specified via command line
+ # 2. harness stored in state file (if continuing job '-c')
+ # 3. default harness
+ selected_harness = None
+ if options.harness:
+ selected_harness = options.harness
+ self._state.set('client', 'harness', selected_harness)
+ else:
+ stored_harness = self._state.get('client', 'harness', None)
+ if stored_harness:
+ selected_harness = stored_harness
+
+ self.harness = harness.select(selected_harness, self)
# set up the status logger
def client_job_record_hook(entry):