summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2024-10-04 17:51:34 +0700
committerGitHub <[email protected]>2024-10-04 17:51:34 +0700
commit4e0d5343b4562560665697a64e3167399773c808 (patch)
treef4bcf99686a11da0d21870a17562878b4a208684 /test
parenteda3cceab207bce390b995462e313ed124fa7732 (diff)
parent31c123aa32f643c18ca14ff9e348e4c2d66e3963 (diff)
Merge pull request #2827 from hathach/ci-dwc2-dma
Ci dwc2 dma
Diffstat (limited to 'test')
-rw-r--r--test/hil/hil_ci_set_matrix.py43
-rw-r--r--test/hil/hil_test.py60
-rw-r--r--test/hil/tinyusb.json3
3 files changed, 80 insertions, 26 deletions
diff --git a/test/hil/hil_ci_set_matrix.py b/test/hil/hil_ci_set_matrix.py
new file mode 100644
index 000000000..192174e16
--- /dev/null
+++ b/test/hil/hil_ci_set_matrix.py
@@ -0,0 +1,43 @@
+import argparse
+import json
+import os
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('config_file', help='Configuration JSON file')
+ args = parser.parse_args()
+
+ config_file = args.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)
+
+ matrix = {
+ 'arm-gcc': [],
+ 'esp-idf': []
+ }
+ for board in config['boards']:
+ name = board['name']
+ if board['flasher'] == 'esptool':
+ toolchain = 'esp-idf'
+ else:
+ toolchain = 'arm-gcc'
+
+ if 'build' in board and 'flags_on' in board['build']:
+ for f in board['build']['flags_on']:
+ if f == '':
+ matrix[toolchain].append(f'-b {name}')
+ else:
+ matrix[toolchain].append(f'-b {name} -f1 {f.replace(" ", " -f1 ")}')
+ else:
+ matrix[toolchain].append(f'-b {name}')
+
+ print(json.dumps(matrix))
+
+
+if __name__ == '__main__':
+ main()
diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py
index cb885aeb5..50f72b30f 100644
--- a/test/hil/hil_test.py
+++ b/test/hil/hil_test.py
@@ -424,37 +424,45 @@ def test_board(board):
test_list.append('device/board_test')
err_count = 0
- for test in test_list:
- fw_dir = f'cmake-build/cmake-build-{name}/{test}'
- if not os.path.exists(fw_dir):
- fw_dir = f'examples/cmake-build-{name}/{test}'
- fw_name = f'{fw_dir}/{os.path.basename(test)}'
- print(f'{name:25} {test:30} ... ', end='')
+ flags_on_list = [""]
+ if 'build' in board and 'flags_on' in board['build']:
+ flags_on_list = board['build']['flags_on']
- if not os.path.exists(fw_dir):
- print('Skip (no binary)')
- continue
+ for f1 in flags_on_list:
+ f1_str = ""
+ if f1 != "":
+ f1_str = '-' + f1.replace(' ', '-')
+ for test in test_list:
+ fw_dir = f'cmake-build/cmake-build-{name}{f1_str}/{test}'
+ if not os.path.exists(fw_dir):
+ fw_dir = f'examples/cmake-build-{name}{f1_str}/{test}'
+ fw_name = f'{fw_dir}/{os.path.basename(test)}'
+ print(f'{name+f1_str:40} {test:30} ... ', end='')
+
+ if not os.path.exists(fw_dir):
+ print('Skip (no binary)')
+ continue
+
+ # flash firmware. It may fail randomly, retry a few times
+ for i in range(3):
+ ret = globals()[f'flash_{flasher}'](board, fw_name)
+ if ret.returncode == 0:
+ break
+ else:
+ print(f'Flashing failed, retry {i+1}')
+ time.sleep(1)
- # flash firmware. It may fail randomly, retry a few times
- for i in range(3):
- ret = globals()[f'flash_{flasher}'](board, fw_name)
if ret.returncode == 0:
- break
+ try:
+ ret = globals()[f'test_{test.replace("/", "_")}'](board)
+ print('OK')
+ except Exception as e:
+ err_count += 1
+ print(STATUS_FAILED)
+ print(f' {e}')
else:
- print(f'Flashing failed, retry {i+1}')
- time.sleep(1)
-
- if ret.returncode == 0:
- try:
- ret = globals()[f'test_{test.replace("/", "_")}'](board)
- print('OK')
- except Exception as e:
err_count += 1
- print(STATUS_FAILED)
- print(f' {e}')
- else:
- err_count += 1
- print(f'Flash {STATUS_FAILED}')
+ print(f'Flash {STATUS_FAILED}')
return err_count
diff --git a/test/hil/tinyusb.json b/test/hil/tinyusb.json
index 066dc5876..1eaa08207 100644
--- a/test/hil/tinyusb.json
+++ b/test/hil/tinyusb.json
@@ -79,6 +79,9 @@
{
"name": "espressif_s3_devkitm",
"uid": "84F703C084E4",
+ "build" : {
+ "flags_on": ["", "CFG_TUD_DWC2_DMA"]
+ },
"tests": {
"only": ["device/cdc_msc_freertos", "device/hid_composite_freertos"]
},