Bash script to test asm decoding output

This commit is contained in:
Joseph Ferano 2024-01-14 09:01:52 +07:00
parent 3b6381f981
commit 9b1d8d4005

22
test_asm.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
make asm_files > /dev/null
for ASM_BIN in asm_files/*.bin;
do
./decode "$ASM_BIN" > output.asm 2> /dev/null
nasm output.asm -o output.bin
ASM_FILE=${ASM_BIN%.*}.asm
diff "${ASM_BIN}" output.bin > /dev/null
if [ $? -eq 0 ]; then
echo -e "${ASM_FILE}: ${GREEN}Decoded properly${NC}"
else
echo -e "${ASM_FILE}: ${RED}Issue decoding assembly${NC}"
fi
rm output.asm output.bin
done