diff mbox

[KVM-AUTOTEST,2/2] Parse guest autotest results from status file

Message ID 1246035651-29508-3-git-send-email-ryanh@us.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ryan Harper June 26, 2009, 5 p.m. UTC
Recently the autotest runs in the guest would pass but we would fail
to parse the results and indicate a failure.  This is probably due to
the logging change as the stdout output includes the [$date DEBUG]
info which breaks scan_results.py:parse_results().  Rather than trying
to parse the output from the ssh connection parse the status file that
the autotest run in the guest generates.  To do this, move the
guest_results scp operation up and then use the new
parse_results_file() method.

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
---
 client/tests/kvm/kvm_tests.py |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)
diff mbox

Patch

diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index 54d2a7a..8fe0fab 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -312,8 +312,17 @@  def run_autotest(test, params, env):
 
     session.close()
 
-    # Parse test results
-    result_list = scan_results.parse_results(output)
+    # Copy test results to the local bindir/guest_results
+    logging.info("Copying results back from guest...")
+    guest_results_dir = os.path.join(test.outputdir, "guest_results")
+    if not os.path.exists(guest_results_dir):
+        os.mkdir(guest_results_dir)
+    if not vm.scp_from_remote("autotest/results/default/*", guest_results_dir):
+        logging.error("Could not copy results back from guest")
+
+    # Parse the test results file the guest generated
+    guest_results_file = os.path.join(guest_results_dir, "status")
+    result_list = scan_results.parse_results_file(guest_results_file)
 
     # Report test results and check for FAIL/ERROR status
     logging.info("Results (test, status, duration, info):")
@@ -338,14 +347,6 @@  def run_autotest(test, params, env):
             message_error = "Test '%s' ended with ABORT"
             " (info: '%s')" % (result[0], result[3])
 
-    # Copy test results to the local bindir/guest_results
-    logging.info("Copying results back from guest...")
-    guest_results_dir = os.path.join(test.outputdir, "guest_results")
-    if not os.path.exists(guest_results_dir):
-        os.mkdir(guest_results_dir)
-    if not vm.scp_from_remote("autotest/results/default/*", guest_results_dir):
-        logging.error("Could not copy results back from guest")
-
     # Fail the test if necessary
     if status_fail:
         raise error.TestFail(message_fail)