From 28d528469559a6dbc6b6dfdf378ff5e917d3e6f0 Mon Sep 17 00:00:00 2001 From: Andrew Alderwick Date: Sun, 16 May 2021 10:20:04 +0100 Subject: [PATCH] Added test suite for asma --- .gitignore | 3 ++- etc/asma-test.sh | 48 ++++++++++++++++++++++++++++++++++++++ projects/software/asma.usm | 2 +- 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100755 etc/asma-test.sh diff --git a/.gitignore b/.gitignore index 853d317..7f7ecce 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ *bmp~ /bin *io.bit -*.bak \ No newline at end of file +*.bak +/*-test \ No newline at end of file diff --git a/etc/asma-test.sh b/etc/asma-test.sh new file mode 100755 index 0000000..7fdecc0 --- /dev/null +++ b/etc/asma-test.sh @@ -0,0 +1,48 @@ +#!/bin/sh +set -e +cd "$(dirname "${0}")/.." +rm -rf asma-test +mkdir asma-test +cd asma-test + +build_asma() { + sed -ne '/^( devices )/,/^( vectors )/p' ../projects/software/asma.usm + cat < asma.usm +../bin/uxnasm asma.usm asma.rom > uxnasm.log +find ../projects -type f -name '*.usm' -not -name 'blank.usm' | sort | while read F; do + echo "Comparing assembly of ${F}" + BN="$(basename "${F%.usm}")" + + if ! ../bin/uxnasm "${F}" "uxnasm-${BN}.rom" > uxnasm.log; then + echo "error: uxnasm failed to assemble ${F}" + tail uxnasm.log + exit 1 + fi + xxd "uxnasm-${BN}.rom" > "uxnasm-${BN}.hex" + + cp "${F}" 'in.usm' + if ! ../bin/debugger asma.rom > asma.log; then + echo "error: asma failed to assemble ${F}, while uxnasm succeeded" + tail asma.log + exit 1 + fi + xxd 'out.rom' > "asma-${BN}.hex" + + diff -u "uxnasm-${BN}.hex" "asma-${BN}.hex" +done +echo 'All OK' + diff --git a/projects/software/asma.usm b/projects/software/asma.usm index c9696e6..a32f567 100644 --- a/projects/software/asma.usm +++ b/projects/software/asma.usm @@ -126,7 +126,7 @@ ;asma/line LDA2 .Console/short DEO2 #2e .Console/char DEO #0a .Console/char DEO - BRK + JMP2r &line 20 "on 20 "line 20 00