If autotest client is run with custom harness, its name is stored
in state file. This allows autotest to continue (e.g. after reboot)
with harness that was specified on first run.

If "--harness" option is present on command line, this
option is used regardless of what is stored in state file.
Added log info about used harness.

Signed-off-by: Jan Stancek <[email protected]>
---
 client/bin/job.py |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/client/bin/job.py b/client/bin/job.py
index 750bf1c..4982039 100644
--- a/client/bin/job.py
+++ b/client/bin/job.py
@@ -174,7 +174,21 @@ 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 = ''
+        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
+
+        logging.info('Selected harness: %s', selected_harness)
+        self.harness = harness.select(selected_harness, self)

         # set up the status logger
         def client_job_record_hook(entry):
-- 
1.7.1
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to