diff options
author | Tom Hughes <tomhughes@chromium.org> | 2020-06-16 13:41:24 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-17 17:28:15 +0000 |
commit | 07b05acbc4f6b23fe820c2bea7041b379742bc06 (patch) | |
tree | 2acece20af8307f916adbe1850384fe42f618e4f /test | |
parent | 07f31dea1e58e8e79d2bfa0b474564e4f5df3de3 (diff) | |
download | chrome-ec-07b05acbc4f6b23fe820c2bea7041b379742bc06.tar.gz |
test/run_device_tests.py: Add utils unit test
Also allow specifying the timeout on a per-test basis. The utils unit
test takes longer than the other tests to run.
BRANCH=none
BUG=b:155230812
TEST=With dragonclaw v0.2 connected to Segger J-Trace and servo micro:
./test/run_device_tests.py -t utils
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I3b7368a4e4178f8371fae1155cf7dc457578dad0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2248713
Reviewed-by: Yicheng Li <yichengli@chromium.org>
Diffstat (limited to 'test')
-rwxr-xr-x | test/run_device_tests.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/run_device_tests.py b/test/run_device_tests.py index fce3a93471..6c6333cc37 100755 --- a/test/run_device_tests.py +++ b/test/run_device_tests.py @@ -60,7 +60,8 @@ class TestConfig: """Configuration for a given test.""" def __init__(self, name, image_to_use=ImageType.RW, finish_regexes=None, - toggle_power=False, test_args=None, num_flash_attempts=2): + toggle_power=False, test_args=None, num_flash_attempts=2, + timeout_secs=10): if test_args is None: test_args = [] if finish_regexes is None: @@ -72,6 +73,7 @@ class TestConfig: self.test_args = test_args self.toggle_power = toggle_power self.num_flash_attempts = num_flash_attempts + self.timeout_secs = timeout_secs self.logs = [] self.passed = False self.num_fails = 0 @@ -119,6 +121,8 @@ ALL_TESTS = { TestConfig(name='sha256_unrolled'), 'stm32f_rtc': TestConfig(name='stm32f_rtc'), + 'utils': + TestConfig(name='utils', timeout_secs=20), } BLOONCHIPPER_CONFIG = BoardConfig( @@ -218,7 +222,7 @@ def readlines_until_timeout(executor, f, timeout_secs): lines.append(line) -def run_test(test, console, executor, timeout_secs=10): +def run_test(test, console, executor): """Run specified test.""" start = time.time() with open(console, "wb+", buffering=0) as c: @@ -237,7 +241,7 @@ def run_test(test, console, executor, timeout_secs=10): line = readline(executor, c, 1) if not line: now = time.time() - if now - start > timeout_secs: + if now - start > test.timeout_secs: logging.debug("Test timed out") return False continue |