Skip to content

Commit ce78999

Browse files
committed
Update GitHub workflows to ignore specific test files and enhance RTT device handling
1 parent 74ffd03 commit ce78999

File tree

5 files changed

+78
-24
lines changed

5 files changed

+78
-24
lines changed

.github/workflows/test-erase.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
- '.github/actions/setup-jlink-network/**'
1313
- '.github/workflows/test-erase.yml'
1414
- '.github/workflows/fw.*'
15+
paths-ignore:
16+
- '.github/workflows/test-scan.yml'
17+
- '.github/workflows/test-flash.yml'
18+
- '.github/workflows/test-rtt.yml'
1519
pull_request:
1620
paths:
1721
- 'src/bmlab_toolkit/erase_cli.py'
@@ -22,6 +26,10 @@ on:
2226
- '.github/actions/setup-jlink-network/**'
2327
- '.github/workflows/test-erase.yml'
2428
- '.github/workflows/fw.*'
29+
paths-ignore:
30+
- '.github/workflows/test-scan.yml'
31+
- '.github/workflows/test-flash.yml'
32+
- '.github/workflows/test-rtt.yml'
2533
workflow_dispatch:
2634

2735
env:

.github/workflows/test-flash.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
- '.github/actions/setup-jlink-network/**'
1313
- '.github/workflows/test-flash.yml'
1414
- '.github/workflows/fw.*'
15+
paths-ignore:
16+
- '.github/workflows/test-scan.yml'
17+
- '.github/workflows/test-erase.yml'
18+
- '.github/workflows/test-rtt.yml'
1519
pull_request:
1620
paths:
1721
- 'src/bmlab_toolkit/flashing.py'
@@ -22,6 +26,10 @@ on:
2226
- '.github/actions/setup-jlink-network/**'
2327
- '.github/workflows/test-flash.yml'
2428
- '.github/workflows/fw.*'
29+
paths-ignore:
30+
- '.github/workflows/test-scan.yml'
31+
- '.github/workflows/test-erase.yml'
32+
- '.github/workflows/test-rtt.yml'
2533
workflow_dispatch:
2634

2735
env:

.github/workflows/test-rtt.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
- '.github/actions/setup-jlink-network/**'
1313
- '.github/workflows/test-rtt.yml'
1414
- '.github/workflows/fw.*'
15+
paths-ignore:
16+
- '.github/workflows/test-scan.yml'
17+
- '.github/workflows/test-flash.yml'
18+
- '.github/workflows/test-erase.yml'
1519
pull_request:
1620
paths:
1721
- 'src/bmlab_toolkit/rtt_cli.py'
@@ -22,6 +26,10 @@ on:
2226
- '.github/actions/setup-jlink-network/**'
2327
- '.github/workflows/test-rtt.yml'
2428
- '.github/workflows/fw.*'
29+
paths-ignore:
30+
- '.github/workflows/test-scan.yml'
31+
- '.github/workflows/test-flash.yml'
32+
- '.github/workflows/test-erase.yml'
2533
workflow_dispatch:
2634

2735
env:
@@ -93,15 +101,17 @@ jobs:
93101
exit 1
94102
fi
95103
96-
- name: Test 3 — RTT multiple devices by serial
104+
- name: Test 3 — RTT multiple devices by serial (sequential)
97105
run: |
98106
. .venv/bin/activate
99107
serial1=$(sed -n '1p' serials.txt)
100108
serial2=$(sed -n '2p' serials.txt)
101109
serial3=$(sed -n '3p' serials.txt)
102110
103111
mkdir -p rtt_logs_serial
104-
timeout 10 bmlab-rtt --serial $serial1 $serial2 $serial3 --output-dir rtt_logs_serial --timeout 3 || true
112+
# Serial devices are processed sequentially (USB driver limitation)
113+
# Total timeout: 3 seconds per device * 3 devices + overhead
114+
timeout 15 bmlab-rtt --serial $serial1 $serial2 $serial3 --mcu STM32F103RE --output-dir rtt_logs_serial --timeout 3 || true
105115
106116
# Check that log files were created
107117
for s in $serial1 $serial2 $serial3; do

.github/workflows/test-scan.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
- 'pyproject.toml'
1212
- '.github/actions/setup-jlink-network/**'
1313
- '.github/workflows/test-scan.yml'
14+
paths-ignore:
15+
- '.github/workflows/test-flash.yml'
16+
- '.github/workflows/test-erase.yml'
17+
- '.github/workflows/test-rtt.yml'
1418
pull_request:
1519
paths:
1620
- 'src/bmlab_toolkit/scan_cli.py'
@@ -20,6 +24,10 @@ on:
2024
- 'pyproject.toml'
2125
- '.github/actions/setup-jlink-network/**'
2226
- '.github/workflows/test-scan.yml'
27+
paths-ignore:
28+
- '.github/workflows/test-flash.yml'
29+
- '.github/workflows/test-erase.yml'
30+
- '.github/workflows/test-rtt.yml'
2331
workflow_dispatch:
2432

2533
env:

src/bmlab_toolkit/rtt_cli.py

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,13 @@ def rtt_device_task(device, output_dir, mcu, programmer_type, reset, timeout, ms
270270

271271

272272
def rtt_multiple_devices(devices, output_dir, mcu, programmer_type, reset, timeout, msg, msg_timeout, msg_retries, log_level):
273-
"""RTT for multiple devices in parallel."""
273+
"""RTT for multiple devices - parallel for IPs, sequential for serials."""
274274
# Create output directory
275275
Path(output_dir).mkdir(parents=True, exist_ok=True)
276276

277+
# Check if we have IP or serial devices
278+
has_ip = any(dev['ip'] for dev in devices)
279+
277280
print(f"Starting RTT for {len(devices)} device(s)")
278281
print(f"Output directory: {output_dir}")
279282
if timeout == 0:
@@ -282,32 +285,49 @@ def rtt_multiple_devices(devices, output_dir, mcu, programmer_type, reset, timeo
282285
print(f"(Reading for {timeout} seconds)\n")
283286

284287
results = []
285-
threads = []
286288

287-
# Start threads for each device
288-
for dev in devices:
289-
device_id = dev['ip'] or f"serial {dev['serial']}" or "auto"
290-
print(f"✓ Started RTT for {device_id}")
289+
if has_ip:
290+
# Parallel execution for IP devices using threads
291+
threads = []
291292

292-
thread = threading.Thread(
293-
target=lambda d=dev: results.append(
294-
rtt_device_task(d, output_dir, mcu, programmer_type, reset, timeout, msg, msg_timeout, msg_retries, log_level)
293+
for dev in devices:
294+
device_id = dev['ip'] or f"serial {dev['serial']}" or "auto"
295+
print(f"✓ Started RTT for {device_id}")
296+
297+
thread = threading.Thread(
298+
target=lambda d=dev: results.append(
299+
rtt_device_task(d, output_dir, mcu, programmer_type, reset, timeout, msg, msg_timeout, msg_retries, log_level)
300+
)
295301
)
296-
)
297-
thread.start()
298-
threads.append(thread)
299-
300-
# Wait for all threads to complete
301-
try:
302-
for thread in threads:
303-
thread.join()
304-
except KeyboardInterrupt:
305-
print("\n\nInterrupted by user. Waiting for threads to finish...")
306-
for thread in threads:
307-
thread.join(timeout=5)
302+
thread.start()
303+
threads.append(thread)
304+
305+
# Wait for all threads to complete
306+
try:
307+
for thread in threads:
308+
thread.join()
309+
except KeyboardInterrupt:
310+
print("\n\nInterrupted by user. Waiting for threads to finish...")
311+
for thread in threads:
312+
thread.join(timeout=5)
313+
else:
314+
# Sequential execution for serial devices (USB driver limitations)
315+
print("Note: Serial devices are processed sequentially due to USB driver limitations\n")
316+
317+
for dev in devices:
318+
device_id = f"serial {dev['serial']}" if dev['serial'] else "auto"
319+
print(f"✓ Processing RTT for {device_id}...")
320+
321+
result = rtt_device_task(dev, output_dir, mcu, programmer_type, reset, timeout, msg, msg_timeout, msg_retries, log_level)
322+
results.append(result)
323+
324+
if result['success']:
325+
print(f" → Completed: {result['file']}\n")
326+
else:
327+
print(f" → Failed: {result.get('error', 'Unknown error')}\n")
308328

309329
# Summary
310-
print(f"\n{'='*60}")
330+
print(f"{'='*60}")
311331
print(f"RTT completed for {len(devices)} device(s)")
312332
print(f"{'='*60}\n")
313333

0 commit comments

Comments
 (0)