diff options
Diffstat (limited to 'test/timer_jump.py')
-rw-r--r-- | test/timer_jump.py | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/test/timer_jump.py b/test/timer_jump.py index f506a69fcf..a4350cecdf 100644 --- a/test/timer_jump.py +++ b/test/timer_jump.py @@ -1,4 +1,4 @@ -# Copyright 2012 The Chromium OS Authors. All rights reserved. +# Copyright 2012 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # @@ -10,22 +10,25 @@ import time DELAY = 5 ERROR_MARGIN = 0.5 + def test(helper): - helper.wait_output("idle task started") - helper.ec_command("sysinfo") - copy = helper.wait_output("Copy:\s+(?P<c>\S+)", use_re=True)["c"] - if copy != "RO": - helper.ec_command("sysjump ro") - helper.wait_output("idle task started") - helper.ec_command("gettime") - ec_start_time = helper.wait_output("Time: 0x[0-9a-f]* = (?P<t>[\d\.]+) s", - use_re=True)["t"] - time.sleep(DELAY) - helper.ec_command("sysjump a") - helper.wait_output("idle task started") - helper.ec_command("gettime") - ec_end_time = helper.wait_output("Time: 0x[0-9a-f]* = (?P<t>[\d\.]+) s", - use_re=True)["t"] + helper.wait_output("idle task started") + helper.ec_command("sysinfo") + copy = helper.wait_output("Copy:\s+(?P<c>\S+)", use_re=True)["c"] + if copy != "RO": + helper.ec_command("sysjump ro") + helper.wait_output("idle task started") + helper.ec_command("gettime") + ec_start_time = helper.wait_output( + "Time: 0x[0-9a-f]* = (?P<t>[\d\.]+) s", use_re=True + )["t"] + time.sleep(DELAY) + helper.ec_command("sysjump a") + helper.wait_output("idle task started") + helper.ec_command("gettime") + ec_end_time = helper.wait_output( + "Time: 0x[0-9a-f]* = (?P<t>[\d\.]+) s", use_re=True + )["t"] - time_diff = float(ec_end_time) - float(ec_start_time) - return time_diff >= DELAY and time_diff <= DELAY + ERROR_MARGIN + time_diff = float(ec_end_time) - float(ec_start_time) + return time_diff >= DELAY and time_diff <= DELAY + ERROR_MARGIN |