All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remember used harness after reboot v3
@ 2011-01-29  1:09 Lucas Meneghel Rodrigues
  0 siblings, 0 replies; only message in thread
From: Lucas Meneghel Rodrigues @ 2011-01-29  1:09 UTC (permalink / raw)
  To: autotest; +Cc: kvm

From: Jan Stancek <jstancek@redhat.com>

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.

Changes from v1: Put the harness debug statement inside the harness
module
Changes from v2: Fix unittest breakage this test was causing. The
underlying unittest code was expecting the default value for the
harness to be None rather than an empty string.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 client/bin/harness.py |    4 +++-
 client/bin/job.py     |   15 ++++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/client/bin/harness.py b/client/bin/harness.py
index b4c9dfd..bcb4f96 100644
--- a/client/bin/harness.py
+++ b/client/bin/harness.py
@@ -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')
diff --git a/client/bin/job.py b/client/bin/job.py
index 127ed94..23de98c 100644
--- a/client/bin/job.py
+++ b/client/bin/job.py
@@ -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):
-- 
1.7.3.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-29  1:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-29  1:09 [PATCH] remember used harness after reboot v3 Lucas Meneghel Rodrigues

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.