Skip to content

Commit 5f69034

Browse files
authored
Merge pull request #3531 from hathach/hil-mtp
enable hil test for mtp
2 parents 6c2c309 + 97297fe commit 5f69034

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,14 @@ jobs:
291291

292292
- name: Test on actual hardware
293293
run: |
294-
python3 test/hil/hil_test.py ${{ env.HIL_JSON }} $SKIP_BOARDS
294+
python3 test/hil/hil_test.py ${{ env.HIL_JSON }} $SKIP_BOARDS || \
295+
(if [ -f "${{ env.HIL_JSON }}.skip" ]; then
296+
SKIP_BOARDS=$(cat "${{ env.HIL_JSON }}.skip")
297+
echo "Re-running with SKIP_BOARDS=$SKIP_BOARDS"
298+
python3 test/hil/hil_test.py ${{ env.HIL_JSON }} $SKIP_BOARDS
299+
else
300+
exit 1
301+
fi)
295302
296303
# ---------------------------------------
297304
# Hardware in the loop (HIL)

.github/workflows/claude-code-review.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66

77
jobs:
88
claude-review:
9+
if: false
910
runs-on: ubuntu-latest
1011
permissions:
1112
contents: read

test/hil/hil_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,16 @@ def open_mtp_dev(uid):
153153
# MTP seems to take a while to enumerate
154154
timeout = 2 * ENUM_TIMEOUT
155155
while timeout > 0:
156-
# run_cmd(f"gio mount -u mtp://TinyUsb_TinyUsb_Device_{uid}/")
156+
# unmount gio/gvfs MTP mount which blocks libmtp from accessing the device
157+
subprocess.run(f"gio mount -u mtp://TinyUsb_TinyUsb_Device_{uid}/",
158+
shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
157159
for raw in mtp.detect_devices():
158160
mtp.device = mtp.mtp.LIBMTP_Open_Raw_Device(ctypes.byref(raw))
159161
if mtp.device:
160162
sn = mtp.get_serialnumber().decode('utf-8')
161-
#print(f'mtp serial = {sn}')
162163
if sn == uid:
163164
return mtp
165+
mtp.disconnect()
164166
time.sleep(1)
165167
timeout -= 1
166168
return None
@@ -753,7 +755,7 @@ def test_device_mtp(board):
753755
'device/cdc_msc_freertos',
754756
'device/hid_boot_interface',
755757
'device/printer_to_cdc',
756-
# 'device/mtp'
758+
'device/mtp'
757759
]
758760

759761
dual_tests = [

0 commit comments

Comments
 (0)