From 9b1d8d4005a23630088177255953212f256f706f Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Sun, 14 Jan 2024 09:01:52 +0700 Subject: [PATCH] Bash script to test asm decoding output --- test_asm.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 test_asm.sh diff --git a/test_asm.sh b/test_asm.sh new file mode 100755 index 0000000..457220a --- /dev/null +++ b/test_asm.sh @@ -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