summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCraig Hesling <hesling@chromium.org>2021-07-26 21:49:41 -0400
committerCommit Bot <commit-bot@chromium.org>2021-07-28 04:30:46 +0000
commit63f9b88896d56d049a0ddec91951f6c76d1a2f3a (patch)
treed135986fd3fb563fcd105c8bf28349fc5694b80c /test
parent4aaa2f7ab2ab63004d4ed49c348f9aa7349e19bc (diff)
downloadchrome-ec-63f9b88896d56d049a0ddec91951f6c76d1a2f3a.tar.gz
test/run_device_tests.py: Plumb "remote" arg to flash_jlink.py
BRANCH=none BUG=none TEST=# Do not start JLinkRemoteServerCLExe ./test/run_device_tests.py --tests stm32f_rtc # Should flash over USB ./test/run_device_tests.py --remote localhost --tests stm32f_rtc # Should fail TEST=JLinkRemoteServerCLExe ./test/run_device_tests.py --remote localhost --tests stm32f_rtc # Ensure that the JLinkRemoteServerCLExe noted two connections. Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I41e1fb32e10877f74d4de7d6d8294b53645434bd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3054819 Reviewed-by: Josie Nordrum <josienordrum@google.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/run_device_tests.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/test/run_device_tests.py b/test/run_device_tests.py
index 9e7f384cb2..43b597bcf1 100755
--- a/test/run_device_tests.py
+++ b/test/run_device_tests.py
@@ -267,23 +267,25 @@ def build(test_name: str, board_name: str) -> None:
subprocess.run(cmd).check_returncode()
-def flash(test_name: str, board: str, flasher: str) -> bool:
+def flash(test_name: str, board: str, flasher: str, remote: str) -> bool:
"""Flash specified test to specified board."""
logging.info("Flashing test")
+ cmd = []
if flasher == JTRACE:
- flash_script = JTRACE_FLASH_SCRIPT
+ cmd.append(JTRACE_FLASH_SCRIPT)
+ if remote:
+ cmd.extend(['--remote', remote])
elif flasher == SERVO_MICRO:
- flash_script = SERVO_MICRO_FLASH_SCRIPT
+ cmd.append(SERVO_MICRO_FLASH_SCRIPT)
else:
logging.error('Unknown flasher: "%s"', flasher)
return False
- cmd = [
- flash_script,
+ cmd.extend([
'--board', board,
'--image', os.path.join(EC_DIR, 'build', board, test_name,
test_name + '.bin'),
- ]
+ ])
logging.debug('Running command: "%s"', ' '.join(cmd))
completed_process = subprocess.run(cmd)
return completed_process.returncode == 0
@@ -429,6 +431,14 @@ def main():
default=JTRACE
)
+ # This might be expanded to serve as a "remote" for flash_ec also, so
+ # we will leave it generic.
+ parser.add_argument(
+ '--remote', '-n',
+ help='The remote host:ip to connect to J-Link. '
+ 'This is passed to flash_jlink.py.',
+ )
+
args = parser.parse_args()
logging.basicConfig(level=args.log_level)
@@ -453,7 +463,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):
+ if flash(test.name, args.board, args.flasher, args.remote):
flash_succeeded = True
break
time.sleep(1)