summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2010-01-10 04:42:38 +0000
committerlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2010-01-10 04:42:38 +0000
commite47fc4ee401fad4fcb3824a9d23ae4da9e42a8ed (patch)
treed73bce76915577f5e7aac748c02a994c8347be59
parent2fee5b51173d92f71c13b7bc319c9a1e0290a2c1 (diff)
KVM-test: Convert drift to absolute value when comparing with threshold
If drift is a large negative, it couldn't raise exception. Signed-off-by: Amos Kong <akong@redhat.com> git-svn-id: svn://test.kernel.org/autotest/trunk@4080 592f7852-d20e-0410-864c-8624ca9c26a4
-rw-r--r--client/tests/kvm/tests/timedrift.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/client/tests/kvm/tests/timedrift.py b/client/tests/kvm/tests/timedrift.py
index 146fa121..b3e8770e 100644
--- a/client/tests/kvm/tests/timedrift.py
+++ b/client/tests/kvm/tests/timedrift.py
@@ -82,7 +82,7 @@ def run_timedrift(test, params, env):
# Set the VM's CPU affinity
prev_affinity = set_cpu_affinity(vm.get_pid(), cpu_mask)
- # Get time before load
+ # Get time before load
# (ht stands for host time, gt stands for guest time)
(ht0, gt0) = kvm_test_utils.get_time(session,
time_command,
@@ -166,8 +166,8 @@ def run_timedrift(test, params, env):
logging.info("Total drift after rest: %.2f%%" % drift_total)
# Fail the test if necessary
- if drift > drift_threshold:
+ if abs(drift) > drift_threshold:
raise error.TestFail("Time drift too large: %.2f%%" % drift)
- if drift_total > drift_threshold_after_rest:
+ if abs(drift_total) > drift_threshold_after_rest:
raise error.TestFail("Time drift too large after rest period: %.2f%%"
% drift_total)