Files
OpenCellular/test/timer_dos.py
Randall Spangler 3266ae6a7e cleanup: Even more TODO comments
Update comments with more info, or remove if no longer applicable.

No code changes.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms; pass unit tests

Change-Id: I5b56eeb500bc0f00e84e91ef99684f4b1b310972
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175418
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-01 20:07:24 +00:00

42 lines
1.0 KiB
Python

# Copyright (c) 2011 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.
#
# Timers test
#
import time
# Test during 5s
DURATION=5
# Linear congruential pseudo random number generator*/
def prng(x):
return (22695477 * x + 1) & 0xffffffff
# period between 500us and 128ms
def period_us(num):
return (((num % 256) + 1) * 500)
# build the same pseudo random sequence as the target
def build_sequence():
# TODO(crosbug.com/p/23800): implement
return []
def test(helper):
helper.wait_output("[Timer task ")
deadline = time.time() + DURATION
seq = []
while time.time() < deadline:
tmr = helper.wait_output("(?P<t>[0-9])", use_re=True,
timeout=1)["t"]
seq.append(tmr)
# Check the results
model = build_sequence()
# TODO(crosbug.com/p/23800): implement
helper.trace("Got %d timer IRQ\n" % len(seq))
return True # PASS !