On 08/11/2012 02:55 AM, Lucas Meneghel Rodrigues wrote:
On Fri, 2012-08-10 at 16:14 +0800, Feng Yang wrote:
After guest's autotest finish, the results directory is copied to
host by get_results() function, so no need to get guest's test status
from guest again.
Signed-off-by: Qingtang Zhou <[email protected]>
Acked-by: Yiqiao Pu <[email protected]>
Signed-off-by: Feng Yang <[email protected]>
---
client/virt/virt_test_utils.py | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/client/virt/virt_test_utils.py b/client/virt/virt_test_utils.py
index 5df6473..f5a2e0c 100644
--- a/client/virt/virt_test_utils.py
+++ b/client/virt/virt_test_utils.py
@@ -1112,20 +1112,27 @@ def run_autotest(vm, session, control_path, timeout,
outputdir, params):
guest_results_dir)
- def get_results_summary(guest_autotest_path):
+ def get_results_summary():
"""
- Get the status of the tests that were executed on the host and close
- the session where autotest was being executed.
+ Get the status of the tests that were executed on the guest.
+ NOTE: This function depends on the results copied to host by
+ get_results() function, so call get_results() first.
"""
- session.cmd("cd %s" % guest_autotest_path)
- output = session.cmd_output("cat results/*/status")
+ status_path = os.path.join(outputdir, "guest_autotest_results",
+ "*/status")
+
+ try:
+ output = utils.system_output("cat %s" % status_path)
+ except IOError, e:
^ Well, the utils.system_output() can never throw an IOError here, so
this exception handling is incorrect. I've fixed it to catch
error.CmdError and committed it to next, thanks!
Thanks for your great help!
+ logging.error("Error getting guest autotest status file: %s", e)
+ return None
+
try:
results = scan_results.parse_results(output)
# Report test results
logging.info("Results (test, status, duration, info):")
for result in results:
- logging.info(str(result))
- session.close()
+ logging.info("\t %s", str(result))
return results
except Exception, e:
logging.error("Error processing guest autotest results: %s", e)
@@ -1223,7 +1230,7 @@ def run_autotest(vm, session, control_path, timeout,
outputdir, params):
except aexpect.ShellTimeoutError:
if vm.is_alive():
get_results(destination_autotest_path)
- get_results_summary(destination_autotest_path)
+ get_results_summary()
raise error.TestError("Timeout elapsed while waiting for job to "
"complete")
else:
@@ -1234,8 +1241,8 @@ def run_autotest(vm, session, control_path, timeout,
outputdir, params):
raise error.TestError("Autotest job on guest failed "
"(Remote session terminated during job)")
- results = get_results_summary(destination_autotest_path)
get_results(destination_autotest_path)
+ results = get_results_summary()
# Make a list of FAIL/ERROR/ABORT results (make sure FAIL results appear
# before ERROR results, and ERROR results appear before ABORT results)
_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel