diff --git a/app/pytest/pytest.ini b/app/pytest/pytest.ini index e610b3c2..a56c8c12 100644 --- a/app/pytest/pytest.ini +++ b/app/pytest/pytest.ini @@ -1,3 +1,6 @@ [pytest] log_cli = True log_cli_level = INFO +env = + JLINK_SERIAL=760208506 + ZSWATCH_BUILD_DIR=debug_rev5 diff --git a/app/pytest/requirements.txt b/app/pytest/requirements.txt index be1bcea3..7cd53262 100644 --- a/app/pytest/requirements.txt +++ b/app/pytest/requirements.txt @@ -18,8 +18,7 @@ psutil # Artifacts package creation bz -# used for CAN <=> host testing -python-can>=4.3.0 - # RTT connection pylink-square + +pytest-env \ No newline at end of file diff --git a/app/pytest/utils.py b/app/pytest/utils.py index 5478ef85..5c9868c1 100644 --- a/app/pytest/utils.py +++ b/app/pytest/utils.py @@ -1,10 +1,9 @@ +import os import subprocess import logging import time import pylink -SERIAL_NUMBER = "760208490" - log = logging.getLogger() @@ -22,7 +21,7 @@ def reset(): "--family", "nrf53", "--snr", - SERIAL_NUMBER, + os.environ["JLINK_SERIAL"], "--reset", ], shell=False, @@ -33,6 +32,8 @@ def reset(): def flash(): + log.info("Using J-Link {}".format(os.environ["JLINK_SERIAL"])) + """Flash firmware""" log.info("Flashing CP_APPLICATION.") subprocess.run( @@ -41,7 +42,7 @@ def flash(): "--family", "nrf53", "--snr", - SERIAL_NUMBER, + os.environ["JLINK_SERIAL"], "--program", "./zswatch_nrf5340_cpuapp@3_debug.hex", "--chiperase", @@ -60,7 +61,7 @@ def flash(): "--family", "nrf53", "--snr", - SERIAL_NUMBER, + os.environ["JLINK_SERIAL"], "--program", "./zswatch_nrf5340_CPUNET.hex", "--coprocessor", @@ -81,7 +82,7 @@ def read_rtt(target_device="nRF5340_XXAA", timeout_ms=10000): jlink = pylink.JLink() logging.getLogger("pylink.jlink").setLevel(logging.WARNING) log.info("Connecting to JLink...") - jlink.open(serial_no=SERIAL_NUMBER) + jlink.open(serial_no=os.environ["JLINK_SERIAL"]) log.info("Connecting to %s..." % target_device) jlink.set_tif(pylink.enums.JLinkInterfaces.SWD) jlink.connect(target_device)