Skip to content

Commit 60e41a4

Browse files
committed
Simplify validation: remove redundant device_count check
- Only check f103_count (Target STM32F103RE) and specific IPs - No need to count 'JLink Remote Server' text occurrences
1 parent b52582a commit 60e41a4

File tree

1 file changed

+27
-42
lines changed

1 file changed

+27
-42
lines changed

.github/workflows/test.yml

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -128,57 +128,42 @@ jobs:
128128
. .venv/bin/activate
129129
bmlab-scan --network $VNET_BASE.0/$VNET_MASK | tee scan6.txt
130130
131-
# device_count=$(grep -c "JLink Remote Server" scan6.txt || echo 0)
132-
# f103_count=$(grep -c "Target:.*STM32F103RE" scan6.txt || echo 0)
131+
f103_count=$(grep -c "Target:.*STM32F103RE" scan6.txt || echo 0)
133132
134-
# if [ "$device_count" -ne 3 ]; then
135-
# echo "Expected 3 devices, found $device_count"
136-
# cat scan6.txt
137-
# exit 1
138-
# fi
139-
140-
# if [ "$f103_count" -ne 3 ]; then
141-
# echo "Expected 3 STM32F103RE devices, found $f103_count"
142-
# cat scan6.txt
143-
# exit 1
144-
# fi
145-
146-
# for ip in 100 101 102; do
147-
# if ! grep -q "IP:.*$VNET_BASE\.$ip" scan6.txt; then
148-
# echo "No device found at $VNET_BASE.$ip"
149-
# cat scan6.txt
150-
# exit 1
151-
# fi
152-
# done
153-
sleep 5
133+
if [ "$f103_count" -ne 3 ]; then
134+
echo "Expected 3 STM32F103RE devices, found $f103_count"
135+
cat scan6.txt
136+
exit 1
137+
fi
154138
139+
for ip in 100 101 102; do
140+
if ! grep -q "IP:.*$VNET_BASE\.$ip" scan6.txt; then
141+
echo "No device found at $VNET_BASE.$ip"
142+
cat scan6.txt
143+
exit 1
144+
fi
145+
done
146+
155147
- name: Test 7 — Network scan with IP range filter
156148
run: |
157149
. .venv/bin/activate
158150
bmlab-scan --network $VNET_BASE.0/$VNET_MASK --start-ip 100 --end-ip 150 | tee scan7.txt
159151
160-
# device_count=$(grep -c "JLink Remote Server" scan7.txt || echo 0)
161-
# f103_count=$(grep -c "Target:.*STM32F103RE" scan7.txt || echo 0)
162-
163-
# if [ "$device_count" -ne 3 ]; then
164-
# echo "Expected 3 devices, found $device_count"
165-
# cat scan7.txt
166-
# exit 1
167-
# fi
152+
f103_count=$(grep -c "Target:.*STM32F103RE" scan7.txt || echo 0)
168153
169-
# if [ "$f103_count" -ne 3 ]; then
170-
# echo "Expected 3 STM32F103RE devices, found $f103_count"
171-
# cat scan7.txt
172-
# exit 1
173-
# fi
154+
if [ "$f103_count" -ne 3 ]; then
155+
echo "Expected 3 STM32F103RE devices, found $f103_count"
156+
cat scan7.txt
157+
exit 1
158+
fi
174159
175-
# for ip in 100 101 102; do
176-
# if ! grep -q "IP:.*$VNET_BASE\.$ip" scan7.txt; then
177-
# echo "No device found at $VNET_BASE.$ip"
178-
# cat scan7.txt
179-
# exit 1
180-
# fi
181-
# done
160+
for ip in 100 101 102; do
161+
if ! grep -q "IP:.*$VNET_BASE\.$ip" scan7.txt; then
162+
echo "No device found at $VNET_BASE.$ip"
163+
cat scan7.txt
164+
exit 1
165+
fi
166+
done
182167
183168
- name: Cleanup after Docker tests
184169
if: always()

0 commit comments

Comments
 (0)