| Index: client/bin/job.py
|
| diff --git a/client/bin/job.py b/client/bin/job.py
|
| index 3e285c6a270c09be1c30a8a369bf9633c69bfd0b..8b8997ecf491b474fef705c3e0c7bd0dd8525008 100644
|
| --- a/client/bin/job.py
|
| +++ b/client/bin/job.py
|
| @@ -179,20 +179,10 @@ class base_client_job(base_job.base_job):
|
| self._next_step_index = 0
|
| self._load_state()
|
|
|
| - # 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
|
| + _harness = self.handle_persistent_option(options, 'harness')
|
| + _harness_args = self.handle_persistent_option(options, 'harness_args')
|
|
|
| - self.harness = harness.select(selected_harness, self)
|
| + self.harness = harness.select(_harness, self, _harness_args)
|
|
|
| # set up the status logger
|
| def client_job_record_hook(entry):
|
| @@ -388,8 +378,8 @@ class base_client_job(base_job.base_job):
|
| self.control = os.path.abspath(control)
|
|
|
|
|
| - def harness_select(self, which):
|
| - self.harness = harness.select(which, self)
|
| + def harness_select(self, which, harness_args):
|
| + self.harness = harness.select(which, self, harness_args)
|
|
|
|
|
| def config_set(self, name, value):
|
| @@ -601,24 +591,25 @@ class base_client_job(base_job.base_job):
|
| try:
|
| self.record('START', subdir, testname)
|
| self._state.set('client', 'unexpected_reboot', (subdir, testname))
|
| - result = function(*args, **dargs)
|
| - self.record('END GOOD', subdir, testname)
|
| - return result
|
| - except error.TestBaseException, e:
|
| - self.record('END %s' % e.exit_status, subdir, testname)
|
| - raise
|
| - except error.JobError, e:
|
| - self.record('END ABORT', subdir, testname)
|
| - raise
|
| - except Exception, e:
|
| - # This should only ever happen due to a bug in the given
|
| - # function's code. The common case of being called by
|
| - # run_test() will never reach this. If a control file called
|
| - # run_group() itself, bugs in its function will be caught
|
| - # here.
|
| - err_msg = str(e) + '\n' + traceback.format_exc()
|
| - self.record('END ERROR', subdir, testname, err_msg)
|
| - raise
|
| + try:
|
| + result = function(*args, **dargs)
|
| + self.record('END GOOD', subdir, testname)
|
| + return result
|
| + except error.TestBaseException, e:
|
| + self.record('END %s' % e.exit_status, subdir, testname)
|
| + raise
|
| + except error.JobError, e:
|
| + self.record('END ABORT', subdir, testname)
|
| + raise
|
| + except Exception, e:
|
| + # This should only ever happen due to a bug in the given
|
| + # function's code. The common case of being called by
|
| + # run_test() will never reach this. If a control file called
|
| + # run_group() itself, bugs in its function will be caught
|
| + # here.
|
| + err_msg = str(e) + '\n' + traceback.format_exc()
|
| + self.record('END ERROR', subdir, testname, err_msg)
|
| + raise
|
| finally:
|
| self._state.discard('client', 'unexpected_reboot')
|
|
|
| @@ -924,6 +915,29 @@ class base_client_job(base_job.base_job):
|
| self._state.set('client', 'steps', [])
|
|
|
|
|
| + def handle_persistent_option(self, options, option_name):
|
| + """
|
| + Select option from command line or persistent state.
|
| + Store selected option to allow standalone client to continue
|
| + after reboot with previously selected options.
|
| + Priority:
|
| + 1. explicitly specified via command line
|
| + 2. stored in state file (if continuing job '-c')
|
| + 3. default == None
|
| + """
|
| + option = None
|
| + cmd_line_option = getattr(options, option_name)
|
| + if cmd_line_option:
|
| + option = cmd_line_option
|
| + self._state.set('client', option_name, option)
|
| + else:
|
| + stored_option = self._state.get('client', option_name, None)
|
| + if stored_option:
|
| + option = stored_option
|
| + logging.debug('Persistent option %s now set to %s', option_name, option)
|
| + return option
|
| +
|
| +
|
| def __create_step_tuple(self, fn, args, dargs):
|
| # Legacy code passes in an array where the first arg is
|
| # the function or its name.
|
|
|