Files
OpenCellular/test/timer_jump.py
Vic Yang b8be40607e Add a test of checking timer value when system jump
This test checks the sanity of timer value when jumping between images.

BUG=chrome-os-partner:9188
TEST=Test passed

Change-Id: If264e28e4ceec6ddb8325f3496825a40e7a038d8
Reviewed-on: https://gerrit.chromium.org/gerrit/25371
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
2012-06-15 23:54:45 -07:00

29 lines
1012 B
Python

# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Timer test: check time sanity when jumping between images
#
import time
DELAY = 5
ERROR_MARGIN = 0.5
def test(helper):
helper.wait_output("Console is enabled")
helper.ec_command("sysjump ro")
helper.wait_output("Console is enabled")
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("Console is enabled")
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