summaryrefslogtreecommitdiff
path: root/test/run_device_tests.py
diff options
context:
space:
mode:
authorPatryk Duda <pdk@semihalf.com>2022-03-30 19:21:46 +0200
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-06 15:10:12 +0000
commitae35143aa53abfb74f1cd285f10e49a331e2f731 (patch)
treeb2a8435ac19e9a81c620c7eece9f8e11aefd3a1a /test/run_device_tests.py
parent669c03751d1b2941a6da225100a966d28903be06 (diff)
downloadchrome-ec-ae35143aa53abfb74f1cd285f10e49a331e2f731.tar.gz
run_device_tests: Add support for overriding board by the test
Dartmonkey board has siblings (nocturne_fp, nami_fp). They share the same codebase, but nocturne_fp and nami_fp board are configured differently (nocturne_fp and nami_fp support different panic data structure layout). Since it's necessary to run only panic data test (which will be introduced later) on nocturne_fp and nami_fp and all three boards are tested on the same physical board we add support for providing information which board should be compiled. BUG=b:221087395 BRANCH=none TEST=./test/run_device_tests.py --board dartmonkey Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I6f8548f77ec3b1126fbdd9c9fb61cedc6425fa98 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3561619 Reviewed-by: Andrea Grandi <agrandi@google.com> Reviewed-by: Bobby Casey <bobbycasey@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Feels: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Patryk Duda <patrykd@google.com>
Diffstat (limited to 'test/run_device_tests.py')
-rwxr-xr-xtest/run_device_tests.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/test/run_device_tests.py b/test/run_device_tests.py
index ff30e0f0e5..2643634062 100755
--- a/test/run_device_tests.py
+++ b/test/run_device_tests.py
@@ -93,7 +93,8 @@ class TestConfig:
def __init__(self, name, image_to_use=ImageType.RW, finish_regexes=None,
fail_regexes=None, toggle_power=False, test_args=None,
num_flash_attempts=2, timeout_secs=10,
- enable_hw_write_protect=False, ro_image=None):
+ enable_hw_write_protect=False, ro_image=None,
+ build_board=None):
if test_args is None:
test_args = []
if finish_regexes is None:
@@ -116,6 +117,7 @@ class TestConfig:
self.num_fails = 0
self.num_passes = 0
self.ro_image = ro_image
+ self.build_board = build_board
# All possible tests.
@@ -361,7 +363,7 @@ def build(test_name: str, board_name: str, compiler: str) -> None:
subprocess.run(cmd).check_returncode() # pylint: disable=subprocess-run-check
-def flash(test_name: str, board: str, flasher: str, remote: str) -> bool:
+def flash(image_path: str, board: str, flasher: str, remote: str) -> bool:
"""Flash specified test to specified board."""
logging.info('Flashing test')
@@ -377,8 +379,7 @@ def flash(test_name: str, board: str, flasher: str, remote: str) -> bool:
return False
cmd.extend([
'--board', board,
- '--image', os.path.join(EC_DIR, 'build', board, test_name,
- test_name + '.bin'),
+ '--image', image_path,
])
logging.debug('Running command: "%s"', ' '.join(cmd))
completed_process = subprocess.run(cmd) # pylint: disable=subprocess-run-check
@@ -562,10 +563,16 @@ def main():
logging.debug('Running tests: %s', [t.name for t in test_list])
for test in test_list:
+ build_board = args.board
+ # If test provides this information, build image for board specified
+ # by test.
+ if test.build_board is not None:
+ build_board = test.build_board
+
# build test binary
- build(test.name, args.board, args.compiler)
+ build(test.name, build_board, args.compiler)
- image_path = os.path.join(EC_DIR, 'build', args.board, test.name,
+ image_path = os.path.join(EC_DIR, 'build', build_board, test.name,
test.name + '.bin')
if test.ro_image is not None:
@@ -583,7 +590,7 @@ def main():
flash_succeeded = False
for i in range(0, test.num_flash_attempts):
logging.debug('Flash attempt %d', i + 1)
- if flash(test.name, args.board, args.flasher, args.remote):
+ if flash(image_path, args.board, args.flasher, args.remote):
flash_succeeded = True
break
time.sleep(1)