From c6ec31daf71cf7bd6f92065fe5b9dd97b0288014 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Wed, 26 Feb 2025 13:24:32 +0100 Subject: [PATCH] tests: Add HIL test for writting bins --- espflash/tests/scripts/write-bin.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 espflash/tests/scripts/write-bin.sh diff --git a/espflash/tests/scripts/write-bin.sh b/espflash/tests/scripts/write-bin.sh new file mode 100644 index 00000000..8fea123b --- /dev/null +++ b/espflash/tests/scripts/write-bin.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# https://github.com/esp-rs/espflash/issues/622 reproducer +echo -ne "\x01\xa0" >binary_file.bin +result=$(espflash write-bin 0x0 binary_file.bin 2>&1) +echo "$result" +if [[ ! $result =~ "Binary successfully written to flash!" ]]; then + echo "Failed to write binary" + exit 1 +fi + +result=$(espflash read-flash 0 64 flash_content.bin 2>&1) +echo "$result" +if [[ ! $result =~ "Flash content successfully read and written to" ]]; then + echo "Failed to read flash content" + exit 1 +fi +# Check that the flash_content.bin contains the '01 a0' bytes +if ! grep -q -a -F $'\x01\xa0' flash_content.bin; then + echo "Failed verifying content" + exit 1 +fi