diff mbox

[AUTOTEST] KVM-test: Convert drift to absolute value when comparing with threshold

Message ID 1262078824-1680-1-git-send-email-akong@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Amos Kong Dec. 29, 2009, 9:27 a.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/tests/timedrift.py b/client/tests/kvm/tests/timedrift.py
index 146fa12..0a211f5 100644
--- a/client/tests/kvm/tests/timedrift.py
+++ b/client/tests/kvm/tests/timedrift.py
@@ -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)