Skip to contentSkip to conversation

kvm autotest in guest scan_results fixes

PATCH In review Ryan Harper 2 participants 5 messages Jun 26, 2009 KVM

lore
Share & tools
lore
#0 lore raw

cover kvm autotest in guest scan_results fixes

When running autotest tests in a kvm guest via client/tests/kvm test, kvm_tests.py attempts to parse the output from the ssh connection. This contains bogus data and fails to parse the results. This patch series switches to parsing the status file that autotest generates.

#1 lore raw

PATCH 1/2 Add parse_results_file method to scan_results.py

o Add a new method, parse_results_file which takes a file, reads the data and invokes the parse_results method.
o Refactor main() method to use parse_results_file.

---
 client/tests/kvm/scan_results.py |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
client/tests/kvm/scan_results.py +8 -5
index 95507bd..175744a 100755
@@ -42,6 +42,13 @@ def parse_results(text):
     return result_list
 
 
+def parse_results_file(resfile):
+    f = file(resfile)
+    text = f.read()
+    f.close()
+    return parse_results(text)
+
+
 def print_result(result):
     """Nicely print a single Autotest result.
 
@@ -55,11 +62,7 @@ def main(resfile):
     print_result(('test', 'status', 'seconds', 'info'))
     print_result(('----', '------', '-------', '----'))
 
-    f = file(resfile)
-    text = f.read()
-    f.close()
-
-    results = parse_results(text)
+    results = parse_results_file(resfile)
     map(print_result, results)
 
 
Signature · 1 line
1.6.0.4
#2 lore raw

PATCH 2/2 Parse guest autotest results from status file

In reply to Ryan Harper

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.

---
 client/tests/kvm/kvm_tests.py |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)
client/tests/kvm/kvm_tests.py +11 -10
index 54d2a7a..8fe0fab 100644
@@ -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)
Signature · 1 line
1.6.0.4
#3 lore raw
In reply to Ryan Harper
Quoted 4 lines · Ryan Harper

When running autotest tests in a kvm guest via client/tests/kvm test, kvm_tests.py attempts to parse the output from the ssh connection. This contains bogus data and fails to parse the results. This patch series switches to parsing the status file that autotest generates.

Hi Ryan, thanks for your patches. However, we've noticed this problem a couple of weeks ago, and I have already made and applied a patch series that fixes the problem in a similar way yours does:

http://autotest.kernel.org/changeset/3279
http://autotest.kernel.org/changeset/3280
http://autotest.kernel.org/changeset/3281

So that means you're probably using an outdated version of the kvm test. Are you using the latest svn trunk or the git mirror?

Quoted 5 lines

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

#4 lore raw
Quoted 10 lines · Lucas Meneghel Rodrigues
Quoted 4 lines · Ryan Harper

When running autotest tests in a kvm guest via client/tests/kvm test, kvm_tests.py attempts to parse the output from the ssh connection. This contains bogus data and fails to parse the results. This patch series switches to parsing the status file that autotest generates.

Hi Ryan, thanks for your patches. However, we've noticed this problem a couple of weeks ago, and I have already made and applied a patch series that fixes the problem in a similar way yours does:

Quoted 6 lines

http://autotest.kernel.org/changeset/3279
http://autotest.kernel.org/changeset/3280
http://autotest.kernel.org/changeset/3281

So that means you're probably using an outdated version of the kvm test. Are you using the latest svn trunk or the git mirror?

Hrm, the linux-kvm.org autotest page[1] still refers to

git://git.kernel.org/pub/scm/virt/kvm/kvm-autotest.git

The last commit there is a merge from

git://github.com/ehabkost/autotest

For some reason I though the kvm-autotest.git was mirroring autotest upstream now the the kvm tests got merged.

Signature · 4 lines
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
[email protected]