From 4127ad6333f345c2e304e634bb0c54d50405ece4 Mon Sep 17 00:00:00 2001 From: Imbus Date: Mon, 9 Feb 2026 14:42:56 +0100 Subject: [PATCH] More tests Include some notes about cleanup and accidentally deleting loop-control --- test.sh | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/test.sh b/test.sh index 6aa0b58..70cfae9 100644 --- a/test.sh +++ b/test.sh @@ -1,6 +1,16 @@ #!/usr/env/bin bash set -e +# set -x # For debugging + +# If you ever mess this up: +# $ sudo mknod /dev/loop-control c 10 237 +# $ sudo chmod 600 /dev/loop-control +# $ sudo chown root:root /dev/loop-control +# +# For cleanup: +# $ sudo find /dev -maxdepth 1 -type b -name 'loop[0-9]*' -exec rm -f {} \; + DISKFILE="/tmp/disk.img" BINFILE="/tmp/file.bin" @@ -11,7 +21,7 @@ echo "Using device: ${LOOPDEV}" cleanup() { echo "Cleaning up..." - set +e + set +e -x sudo losetup -d ${LOOPDEV} sudo rm ${LOOPDEV} sudo rm ${BINFILE} ${DISKFILE} @@ -40,4 +50,16 @@ fi sudo ./writeimg -nd ${LOOPDEV} ${BINFILE} sudo ./writeimg -vnd ${LOOPDEV} ${BINFILE} -echo "Looks good!" +sudo ./writeimg -nd ${LOOPDEV} ./writeimg +sudo ./writeimg -vnd ${LOOPDEV} ./writeimg + +sudo ./writeimg -nd ${LOOPDEV} ./LICENSE +sudo ./writeimg -vnd ${LOOPDEV} ./LICENSE + +# Redirect this to avoid confusion +! sudo ./writeimg -vnd ${LOOPDEV} ./crc32.h 2>/dev/null + +GREEN="\e[32m" +RESET="\e[0m" + +echo -e "\n\n${GREEN}Looks good!${RESET}"