Skip to content

Commit c6b82b1

Browse files
committed
ci: Add erase-region, hold-in-reset, reset and checksum-md5 tests
1 parent ad2c463 commit c6b82b1

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/hil.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,56 @@ jobs:
155155
if ! echo "$result" | grep -q "Hello world!"; then
156156
exit 1
157157
fi
158+
159+
- name: erase-region test
160+
run: |
161+
result=$(espflash_app/espflash erase-region 0x1000 0x1000 2>&1)
162+
echo "$result"
163+
if [[ ! $result =~ "Erasing region at" ]]; then
164+
exit 1
165+
fi
166+
result=$(espflash_app/espflash read-flash 0x1000 0x2000 flash_content.bin 2>&1)
167+
echo "$result"
168+
if [[ ! $result =~ "Flash content successfully read and written to" ]]; then
169+
exit 1
170+
fi
171+
# Check first 0x1000 bytes are FF
172+
if head -c 4096 flash_content.bin | hexdump -v -e '/1 "%02x"' | grep -qv '^ff*$'; then
173+
echo "First 0x1000 bytes should be empty (FF)"
174+
exit 1
175+
fi
176+
# Check next 0x1000 bytes contain some non-FF bytes
177+
if ! tail -c 4096 flash_content.bin | hexdump -v -e '/1 "%02x"' | grep -q '[0-e]'; then
178+
echo "Next 0x1000 bytes should contain some non-FF bytes"
179+
exit 1
180+
fi
181+
echo "Flash contents verified!"
182+
183+
- name: hold-in-reset test
184+
run: |
185+
result=$(espflash_app/espflash hold-in-reset 2>&1)
186+
echo "$result"
187+
if [[ ! $result =~ "Holding target device in reset" ]]; then
188+
exit 1
189+
fi
190+
191+
- name: reset test
192+
run: |
193+
result=$(espflash_app/espflash reset 2>&1)
194+
echo "$result"
195+
if [[ ! $result =~ "Resetting target device" ]]; then
196+
exit 1
197+
fi
198+
199+
- name: checksum-md5 test
200+
run: |
201+
result=$(espflash_app/espflash erase-flash 2>&1)
202+
echo "$result"
203+
if [[ ! $result =~ "Flash has been erased!" ]]; then
204+
exit 1
205+
fi
206+
result=$(espflash_app/espflash checksum-md5 --address 0x1000 --length 0x100 2>&1)
207+
echo "$result"
208+
if [[ ! $result =~ "0x827f263ef9fb63d05499d14fcef32f60" ]]; then
209+
exit 1
210+
fi

0 commit comments

Comments
 (0)