From ea20bd9b5bcff9db1d86d83188e1e899799f324b Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sat, 23 Aug 2025 16:22:13 +0200 Subject: checkpoint --- archived/less_old_sim8086/misc/test_listing | 50 ++++++++++++++ .../less_old_sim8086/misc/test_source_line_by_line | 80 ++++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100755 archived/less_old_sim8086/misc/test_listing create mode 100755 archived/less_old_sim8086/misc/test_source_line_by_line (limited to 'archived/less_old_sim8086/misc') diff --git a/archived/less_old_sim8086/misc/test_listing b/archived/less_old_sim8086/misc/test_listing new file mode 100755 index 0000000..472c0d2 --- /dev/null +++ b/archived/less_old_sim8086/misc/test_listing @@ -0,0 +1,50 @@ +#!/bin/sh + +NoColor= +if [ "$1" = "--no-color" ] +then + NoColor=1 + shift +fi + +ThisDir="$(dirname "$(readlink -f "$0")")" + +for File in $@ +do + File="$(readlink -f "$File")" + [ "$File" ] || exit 1 + + ( + cd "$ThisDir" + + SourceFile="$File" + SourceFile="${File%.asm}.asm" + [ -r "$SourceFile" ] || exit 1 + + ErrorFile="../build/error" + TestSource="../build/first" + OutFile="../build/$(basename "${SourceFile%.asm}")" + nasm -o "$OutFile" "$SourceFile" 2> "$ErrorFile" + ../build/sim8086 "$OutFile" > "$TestSource".asm 2>> "$ErrorFile" + nasm -o "${TestSource}" "$TestSource".asm 2>> "$ErrorFile" + + RelPath="$(realpath --relative-to=. "$SourceFile")" + if diff -q "$TestSource" "$OutFile" > /dev/null 2>> "$ErrorFile" + then + if [ "$NoColor" ] + then + printf ' PASSED: '\''%s'\''\n' "$RelPath" + else + printf '\033[32m PASSED: '\''%s'\''\033[0m\n' "$RelPath" + fi + else + if [ "$NoColor" ] + then + printf ' FAILED: '\''%s'\''\n' "$RelPath" + else + printf '\033[31m FAILED: '\''%s'\''\033[0m\n' "$RelPath" + fi + cat "$ErrorFile" | sed 's/.*/ &/' + fi + ) +done diff --git a/archived/less_old_sim8086/misc/test_source_line_by_line b/archived/less_old_sim8086/misc/test_source_line_by_line new file mode 100755 index 0000000..dbf657c --- /dev/null +++ b/archived/less_old_sim8086/misc/test_source_line_by_line @@ -0,0 +1,80 @@ +#!/bin/sh + +PauseOnFail= +if [ "$1" = "--pause-on-fail" ] +then + PauseOnFail=1 + shift +fi + +NoColor= +if [ "$1" = "--no-color" ] +then + NoColor=1 + shift +fi + +if [ -z "$1" ] +then + >&2 printf 'Usage: single_tester.sh \n' + return 1 +fi + +ThisDir="$(dirname "$(readlink -f "$0")")" + +for File in $@ +do + SourceFile="$(readlink -f "$File")" + [ "$SourceFile" ] || exit 1 + SourceFile="${SourceFile%.asm}.asm" + [ -r "$SourceFile" ] || exit 1 + >&2 printf 'File: %s\n' "$File" + + ( + cd "$ThisDir" + + Stripped="${SourceFile%.asm}" + OutName="../build/$(basename "$Stripped")" + + grep -v '^$\|^;\|^bits' "$SourceFile" | + while read -r line + do + first="${OutName}_first" + second="${OutName}_second" + error="${OutName}_error" + + printf 'bits 16\n%s\n' "$line" > "$first".asm + + nasm -o "$first" "$first".asm 2> "$error" + ../build/sim8086 "$first" > "$second".asm 2> "$error" + nasm -o "$second" "$second".asm 2>> "$error" + + if diff -q "$first" "$second" > /dev/null 2>> "$error" + then + if [ "$NoColor" ] + then + printf ' PASSED: '\''%s'\''\n' "$line" + else + printf '\033[32m PASSED: '\''%s'\''\033[0m\n' "$line" + fi + else + if [ "$NoColor" ] + then + printf ' FAILED: '\''%s'\''\n' "$SourceFile" + else + printf '\033[31m FAILED: '\''%s'\''\033[0m\n' "$SourceFile" + fi + cat "$error" | sed 's/.*/ &/' + printf ' listing> %s\n' "$line" + printf ' sim8086> %s\n' "$(grep -v '^$\|^;\|bits' "$second".asm)" + + if [ "$PauseOnFail" ] + then + exit + fi + + fi + rm -f "$error" "$second" "$second".asm "$first" "$first".asm + done + ) +done -- cgit v1.2.3-70-g09d2