Skip to content

Commit c6ec31d

Browse files
committed
tests: Add HIL test for writting bins
1 parent 661ed32 commit c6ec31d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

espflash/tests/scripts/write-bin.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
# https://github.com/esp-rs/espflash/issues/622 reproducer
4+
echo -ne "\x01\xa0" >binary_file.bin
5+
result=$(espflash write-bin 0x0 binary_file.bin 2>&1)
6+
echo "$result"
7+
if [[ ! $result =~ "Binary successfully written to flash!" ]]; then
8+
echo "Failed to write binary"
9+
exit 1
10+
fi
11+
12+
result=$(espflash read-flash 0 64 flash_content.bin 2>&1)
13+
echo "$result"
14+
if [[ ! $result =~ "Flash content successfully read and written to" ]]; then
15+
echo "Failed to read flash content"
16+
exit 1
17+
fi
18+
# Check that the flash_content.bin contains the '01 a0' bytes
19+
if ! grep -q -a -F $'\x01\xa0' flash_content.bin; then
20+
echo "Failed verifying content"
21+
exit 1
22+
fi

0 commit comments

Comments
 (0)