On 03/06/2013 06:59 AM, Mike Qiu wrote:
When run the command ./run -t qemu as default, all the case may skip. and this will raise an error: TESTS: 13 (1/13) migrate.default.tcp: SKIP (2/13) migrate.default.unix: SKIP (3/13) migrate.default.exec: SKIP (4/13) migrate.default.fd: SKIP (5/13) migrate.default.mig_cancel: SKIP (6/13) migrate.with_set_speed.tcp: SKIP (7/13) migrate.with_set_speed.unix: SKIP (8/13) migrate.with_set_speed.exec: SKIP (9/13) migrate.with_set_speed.fd: SKIP (10/13) migrate.with_reboot.tcp: SKIP (11/13) migrate.with_reboot.unix: SKIP (12/13) migrate.with_reboot.exec: SKIP (13/13) migrate.with_reboot.fd: SKIP TOTAL TIME: 9.58 s Internal error, traceback follows... Traceback (most recent call last): File "/home/Mike/autotest/client/tests/virt/virttest/standalone_test.py", line 872, in run_tests _job_report(job_elapsed_time, n_tests, n_tests_skipped, n_tests_failed) File "/home/Mike/autotest/client/tests/virt/virttest/standalone_test.py", line 659, in _job_report float(n_tests - n_tests_skipped)) * 100) ZeroDivisionError: float division by zeroSo just check if n_tests equals to n_tests_skipped to avoid this error
Although this is a valid fix (it is always good to avoid divisions by zero), I wonder what the heck happened for ALL the tests to be skipped... I'll apply this, thanks!
Signed-off-by: Mike Qiu <[email protected]> --- virttest/standalone_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/virttest/standalone_test.py b/virttest/standalone_test.py index 2bc46c3..83d041a 100644 --- a/virttest/standalone_test.py +++ b/virttest/standalone_test.py @@ -655,7 +655,9 @@ def _job_report(job_elapsed_time, n_tests, n_tests_skipped, n_tests_failed): logging.info("Job total elapsed time: %.2f s", job_elapsed_time) n_tests_passed = n_tests - n_tests_skipped - n_tests_failed - success_rate = ((float(n_tests_passed) / + success_rate = 0 + if n_tests != n_tests_skipped: + success_rate = ((float(n_tests_passed) / float(n_tests - n_tests_skipped)) * 100) print_header("TESTS PASSED: %d" % n_tests_passed)
_______________________________________________ Virt-test-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/virt-test-devel
