summaryrefslogtreecommitdiff
path: root/test/run_device_tests.py
diff options
context:
space:
mode:
authorKevin Shelton <kmshelton@chromium.org>2021-05-04 13:16:50 -0700
committerCommit Bot <commit-bot@chromium.org>2021-05-07 19:06:44 +0000
commite371bbee46cf5a2a21339d2afcf2d59ef6f57d45 (patch)
treeab46f31b5e44a80040e6562350ae215fe75558de /test/run_device_tests.py
parent92ccd12aeb8cd4fd0f6463c66e4d9c2e6836d586 (diff)
downloadchrome-ec-e371bbee46cf5a2a21339d2afcf2d59ef6f57d45.tar.gz
fingerprint: Support flash_ec in dev test runner
BRANCH=none BUG=b:151105339 TEST=with a dragonclaw rev 0.2: ./test/run_device_tests.py --flasher=servo_micro (flash_write_protect failed and the test runner hung after printing the test status, but this seems unrelated; all of the other tests looked to pass), ./test/run_device_tests.py and ./test/run_device_tests.py --flasher=jtrace (both get as far as executing flash_jlink.py, so the argument logic should be ok). Signed-off-by: Kevin Shelton <kmshelton@chromium.org> Change-Id: I0d41fb2fa4170292dd5a1212c601cf059ce2ee7b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2872432 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'test/run_device_tests.py')
-rwxr-xr-xtest/run_device_tests.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/test/run_device_tests.py b/test/run_device_tests.py
index 6cc1702760..4bc4b020ea 100755
--- a/test/run_device_tests.py
+++ b/test/run_device_tests.py
@@ -28,7 +28,8 @@ from typing import Optional, BinaryIO, List
import colorama # type: ignore[import]
EC_DIR = Path(os.path.dirname(os.path.realpath(__file__))).parent
-FLASH_SCRIPT = os.path.join(EC_DIR, 'util/flash_jlink.py')
+JTRACE_FLASH_SCRIPT = os.path.join(EC_DIR, 'util/flash_jlink.py')
+SERVO_MICRO_FLASH_SCRIPT = os.path.join(EC_DIR, 'util/flash_ec')
ALL_TESTS_PASSED_REGEX = re.compile(r'Pass!\r\n')
ALL_TESTS_FAILED_REGEX = re.compile(r'Fail! \(\d+ tests\)\r\n')
@@ -54,6 +55,9 @@ DATA_ACCESS_VIOLATION_24000000_REGEX = re.compile(
BLOONCHIPPER = 'bloonchipper'
DARTMONKEY = 'dartmonkey'
+JTRACE = 'jtrace'
+SERVO_MICRO = 'servo_micro'
+
class ImageType(Enum):
"""EC Image type to use for the test."""
@@ -261,14 +265,19 @@ def build(test_name: str, board_name: str) -> None:
subprocess.run(cmd).check_returncode()
-def flash(test_name: str, board: str) -> bool:
+def flash(test_name: str, board: str, flasher: str) -> bool:
"""Flash specified test to specified board."""
logging.info("Flashing test")
- # TODO(b/151105339): Support ./util/flash_ec as well. It's slower, but only
- # requires servo micro.
+ if flasher == JTRACE:
+ flash_script = JTRACE_FLASH_SCRIPT
+ elif flasher == SERVO_MICRO:
+ flash_script = SERVO_MICRO_FLASH_SCRIPT
+ else:
+ logging.error('Unknown flasher: "%s"', flasher)
+ return False
cmd = [
- FLASH_SCRIPT,
+ flash_script,
'--board', board,
'--image', os.path.join(EC_DIR, 'build', board, test_name,
test_name + '.bin'),
@@ -411,6 +420,13 @@ def main():
default='DEBUG'
)
+ flasher_choices = [SERVO_MICRO, JTRACE]
+ parser.add_argument(
+ '--flasher', '-f',
+ choices=flasher_choices,
+ default=JTRACE
+ )
+
args = parser.parse_args()
logging.basicConfig(level=args.log_level)
@@ -435,7 +451,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):
+ if flash(test.name, args.board, args.flasher):
flash_succeeded = True
break
time.sleep(1)