summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2024-07-28 11:59:52 +0200
committerHiFiPhile <[email protected]>2024-07-28 11:59:52 +0200
commitf48a4567a6f97c6f814ad6cd3de544bcce42e585 (patch)
tree2b5e4d18f4d1ac827f97531db6729ecb13583189 /test
parentb0f5422262a26fb1ab496e33bb8009efb6660788 (diff)
parentcfbdc44a8d099240ad5ef208bd639487c2f28153 (diff)
Merge branch 'master' of https://github.com/hathach/tinyusb into rx_fb
Diffstat (limited to 'test')
-rw-r--r--test/hil/hil_test.py47
-rw-r--r--test/hil/pi4.json37
-rw-r--r--test/hil/rpi.json58
3 files changed, 86 insertions, 56 deletions
diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py
index c2699cc6f..158841687 100644
--- a/test/hil/hil_test.py
+++ b/test/hil/hil_test.py
@@ -114,11 +114,10 @@ def read_disk_file(id, fname):
# Flashing firmware
# -------------------------------------------------------------
def run_cmd(cmd):
- # print(cmd)
+ #print(cmd)
r = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- title = 'command error'
if r.returncode != 0:
- # print build output if failed
+ title = 'command error'
if os.getenv('CI'):
print(f"::group::{title}")
print(r.stdout.decode("utf-8"))
@@ -156,23 +155,23 @@ def flash_esptool(board, firmware):
return ret
-def doublereset_with_rpi_gpio(board):
+def doublereset_with_rpi_gpio(pin):
# Off = 0 = Reset
- led = gpiozero.LED(board["flasher_reset_pin"])
+ nrst = gpiozero.LED(pin)
- led.off()
+ nrst.off()
time.sleep(0.1)
- led.on()
+ nrst.on()
time.sleep(0.1)
- led.off()
+ nrst.off()
time.sleep(0.1)
- led.on()
+ nrst.on()
def flash_bossac(board, firmware):
# double reset to enter bootloader
if platform.machine() == 'aarch64':
- doublereset_with_rpi_gpio(board)
+ doublereset_with_rpi_gpio(board["flasher_reset_pin"])
port = get_serial_dev(board["uid"], board["flashser_vendor"], board["flasher_product"], 0)
timeout = ENUM_TIMEOUT
@@ -330,13 +329,19 @@ def main():
config_file = args.config_file
boards = args.board
- config_file = os.path.join(os.path.dirname(__file__), config_file)
+ # if config file is not found, try to find it in the same directory as this script
+ if not os.path.exists(config_file):
+ config_file = os.path.join(os.path.dirname(__file__), config_file)
with open(config_file) as f:
config = json.load(f)
- # all possible tests
+ # all possible tests: board_test is added last to disable board's usb
all_tests = [
- 'cdc_dual_ports', 'cdc_msc', 'dfu', 'dfu_runtime', 'hid_boot_interface',
+ 'cdc_dual_ports',
+ 'cdc_msc', 'cdc_msc_freertos',
+ 'dfu', 'dfu_runtime',
+ 'hid_boot_interface',
+ 'board_test'
]
if len(boards) == 0:
@@ -351,12 +356,9 @@ def main():
# default to all tests
if 'tests' in item:
- test_list = item['tests']
+ test_list = item['tests'] + ['board_test']
else:
- test_list = all_tests
-
- # board_test is added last to disable board's usb
- test_list.append('board_test')
+ test_list = list(all_tests)
# remove skip_tests
if 'tests_skip' in item:
@@ -365,9 +367,16 @@ def main():
test_list.remove(skip)
for test in test_list:
- fw_name = f'cmake-build/cmake-build-{name}/device/{test}/{test}'
+ fw_dir = f'cmake-build/cmake-build-{name}/device/{test}'
+ if not os.path.exists(fw_dir):
+ fw_dir = f'examples/cmake-build-{name}/device/{test}'
+ fw_name = f'{fw_dir}/{test}'
print(f' {test} ...', end='')
+ if not os.path.exists(fw_dir):
+ print('Skip')
+ continue
+
# flash firmware. It may fail randomly, retry a few times
for i in range(3):
ret = globals()[f'flash_{flasher}'](item, fw_name)
diff --git a/test/hil/pi4.json b/test/hil/pi4.json
deleted file mode 100644
index bdb8a5fa5..000000000
--- a/test/hil/pi4.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "boards": [
- {
- "name": "raspberry_pi_pico",
- "uid": "E6614C311B764A37",
- "flasher": "openocd",
- "flasher_sn": "E6614103E72C1D2F",
- "flasher_args": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 5000\""
- },
- {
- "name": "feather_nrf52840_express",
- "uid": "1F0479CD0F764471",
- "flasher": "jlink",
- "flasher_sn": "000682804350",
- "flasher_args": "-device nrf52840_xxaa"
- },
- {
- "name": "itsybitsy_m4",
- "uid": "D784B28C5338533335202020FF044726",
- "flasher": "bossac",
- "flashser_vendor": "Adafruit Industries",
- "flasher_product": "ItsyBitsy M4 Express",
- "flasher_reset_pin": "2",
- "flasher_args": "--offset 0x4000"
- },
- {
- "name": "espressif_s3_devkitm",
- "uid": "84F703C084E4",
- "tests": [
- "cdc_msc_freertos", "hid_composite_freertos"
- ],
- "flasher": "esptool",
- "flasher_sn": "3ea619acd1cdeb11a0a0b806e93fd3f1",
- "flasher_args": "-b 1500000"
- }
- ]
-}
diff --git a/test/hil/rpi.json b/test/hil/rpi.json
new file mode 100644
index 000000000..dae3094b5
--- /dev/null
+++ b/test/hil/rpi.json
@@ -0,0 +1,58 @@
+{
+ "boards": [
+ {
+ "name": "raspberry_pi_pico",
+ "uid": "E6614C311B764A37",
+ "flasher": "openocd",
+ "flasher_sn": "E6614103E72C1D2F",
+ "flasher_args": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 5000\""
+ },
+ {
+ "name": "feather_nrf52840_express",
+ "uid": "1F0479CD0F764471",
+ "flasher": "jlink",
+ "flasher_sn": "000682804350",
+ "flasher_args": "-device nrf52840_xxaa"
+ },
+ {
+ "name": "itsybitsy_m4",
+ "uid": "D784B28C5338533335202020FF044726",
+ "flasher": "openocd",
+ "flasher_sn": "E6614C311B597D32",
+ "flasher_args": "-f interface/cmsis-dap.cfg -f target/atsame5x.cfg -c \"adapter speed 5000\""
+ },
+ {
+ "name": "espressif_s3_devkitm",
+ "uid": "84F703C084E4",
+ "tests": [
+ "cdc_msc_freertos", "hid_composite_freertos"
+ ],
+ "flasher": "esptool",
+ "flasher_sn": "3ea619acd1cdeb11a0a0b806e93fd3f1",
+ "flasher_args": "-b 921600"
+ },
+ {
+ "name": "metro_m7_1011",
+ "uid": "9CE8715DD71137363E00005002004200",
+ "flasher": "jlink",
+ "flasher_sn": "000611000000",
+ "flasher_args": "-device MIMXRT1011xxx5A"
+ },
+ {
+ "name": "ra4m1_ek",
+ "uid": "152E163038303131393346E46F26574B",
+ "tests_skip": ["cdc_msc", "cdc_msc_freertos"],
+ "comment": "MSC is slow to enumerated #2602",
+ "flasher": "jlink",
+ "flasher_sn": "000831174392",
+ "flasher_args": "-device R7FA4M1AB"
+ },
+ {
+ "name": "lpcxpresso11u37",
+ "uid": "17121919",
+ "flasher": "jlink",
+ "flasher_sn": "000724441579",
+ "flasher_args": "-device LPC11U37/401"
+ }
+ ]
+}