summaryrefslogtreecommitdiff
path: root/test/full-pipeline
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2019-08-11 17:22:20 +1200
committerDavid Phillips <david@sighup.nz>2019-08-11 17:22:20 +1200
commit2d2628df0001d2b643811dc69717c4afe70c4e31 (patch)
treef5d0da23c47c3e677ca423a91838c5ad5467a5d9 /test/full-pipeline
parent0e6f47211a0516cf2c96d2b9e89c0d841978c143 (diff)
downloadtoy-cpu-assembler-2d2628df0001d2b643811dc69717c4afe70c4e31.tar.xz
Fix and add tests for NULL deref cases found by scan-build
Diffstat (limited to 'test/full-pipeline')
-rwxr-xr-xtest/full-pipeline/run-full-pipeline.sh21
-rw-r--r--test/full-pipeline/should-pass/001-nop.asm (renamed from test/full-pipeline/001-nop.asm)0
-rw-r--r--test/full-pipeline/should-pass/002-nops.asm (renamed from test/full-pipeline/002-nops.asm)0
-rw-r--r--test/full-pipeline/should-pass/003-rtype.asm (renamed from test/full-pipeline/003-rtype.asm)0
-rw-r--r--test/full-pipeline/should-pass/004-itype.asm (renamed from test/full-pipeline/004-itype.asm)0
-rw-r--r--test/full-pipeline/should-pass/005-small-loop.asm (renamed from test/full-pipeline/005-small-loop.asm)0
-rw-r--r--test/full-pipeline/should-pass/006-2-inst-2-words.asm (renamed from test/full-pipeline/006-2-inst-2-words.asm)0
-rw-r--r--test/full-pipeline/should-pass/007-3-inst-3-words.asm (renamed from test/full-pipeline/007-3-inst-3-words.asm)0
-rw-r--r--test/full-pipeline/should-pass/008-3-inst-5-words.asm (renamed from test/full-pipeline/008-3-inst-5-words.asm)0
-rw-r--r--test/full-pipeline/should-pass/009-3-inst-5-words-rev.asm (renamed from test/full-pipeline/009-3-inst-5-words-rev.asm)0
-rw-r--r--test/full-pipeline/should-pass/010-empty.asm (renamed from test/full-pipeline/010-empty.asm)0
11 files changed, 11 insertions, 10 deletions
diff --git a/test/full-pipeline/run-full-pipeline.sh b/test/full-pipeline/run-full-pipeline.sh
index 25f7bf7..c5a1700 100755
--- a/test/full-pipeline/run-full-pipeline.sh
+++ b/test/full-pipeline/run-full-pipeline.sh
@@ -11,6 +11,7 @@
fail() {
echo -e '[\e[1;31mFAIL\e[0m] '"$1:" "$2"
+ has_failure=1
}
pass() {
@@ -34,33 +35,33 @@ export ASM="$PWD/../../assembler"
export DISASM="$PWD/../../disassembler"
has_failure=0
-for first_stage_asm in *.asm ; do
- first_stage_bin="$WORK/${first_stage_asm}-first_stage.bin"
- second_stage_asm="$WORK/${first_stage_asm}-second_stage.asm"
- second_stage_bin="$WORK/${first_stage_asm}-second_stage.bin"
+for first_stage_asm in should-pass/*.asm ; do
+ t=$(basename "$first_stage_asm")
+ first_stage_bin="$WORK/${t}-first_stage.bin"
+ second_stage_asm="$WORK/${t}-second_stage.asm"
+ second_stage_bin="$WORK/${t}-second_stage.bin"
# Assemble test code
if ! $VALGRIND $VALGRIND_OPTS "$ASM" "$first_stage_asm" "$first_stage_bin" ; then
- fail "$first_stage_asm" "first stage assembly failed"
+ fail "$t" "first stage assembly failed"
continue
fi
# Disassemble test code and re-assemble that disassembly
if ! $VALGRIND $VALGRIND_OPTS "$DISASM" "$first_stage_bin" "$second_stage_asm" ; then
- fail "$first_stage_asm" "first stage disassembly failed"
+ fail "$t" "first stage disassembly failed"
continue
fi
if ! $VALGRIND $VALGRIND_OPTS "$ASM" "$second_stage_asm" "$second_stage_bin" ; then
- fail "$first_stage_asm" "second stage assembly failed"
+ fail "$t" "second stage assembly failed"
continue
fi
# first stage bin and second stage identical for test pass
if diff "$first_stage_bin" "$second_stage_bin" >/dev/null; then
- pass "$first_stage_asm"
+ pass "$t"
else
- fail "$first_stage_asm" "binary mismatch"
- has_failure=1
+ fail "$t" "binary mismatch"
fi
done
diff --git a/test/full-pipeline/001-nop.asm b/test/full-pipeline/should-pass/001-nop.asm
index c27745a..c27745a 100644
--- a/test/full-pipeline/001-nop.asm
+++ b/test/full-pipeline/should-pass/001-nop.asm
diff --git a/test/full-pipeline/002-nops.asm b/test/full-pipeline/should-pass/002-nops.asm
index 45a3cbf..45a3cbf 100644
--- a/test/full-pipeline/002-nops.asm
+++ b/test/full-pipeline/should-pass/002-nops.asm
diff --git a/test/full-pipeline/003-rtype.asm b/test/full-pipeline/should-pass/003-rtype.asm
index 7ed5f78..7ed5f78 100644
--- a/test/full-pipeline/003-rtype.asm
+++ b/test/full-pipeline/should-pass/003-rtype.asm
diff --git a/test/full-pipeline/004-itype.asm b/test/full-pipeline/should-pass/004-itype.asm
index 4fbc032..4fbc032 100644
--- a/test/full-pipeline/004-itype.asm
+++ b/test/full-pipeline/should-pass/004-itype.asm
diff --git a/test/full-pipeline/005-small-loop.asm b/test/full-pipeline/should-pass/005-small-loop.asm
index 5c47e51..5c47e51 100644
--- a/test/full-pipeline/005-small-loop.asm
+++ b/test/full-pipeline/should-pass/005-small-loop.asm
diff --git a/test/full-pipeline/006-2-inst-2-words.asm b/test/full-pipeline/should-pass/006-2-inst-2-words.asm
index c4e2dbc..c4e2dbc 100644
--- a/test/full-pipeline/006-2-inst-2-words.asm
+++ b/test/full-pipeline/should-pass/006-2-inst-2-words.asm
diff --git a/test/full-pipeline/007-3-inst-3-words.asm b/test/full-pipeline/should-pass/007-3-inst-3-words.asm
index 717a122..717a122 100644
--- a/test/full-pipeline/007-3-inst-3-words.asm
+++ b/test/full-pipeline/should-pass/007-3-inst-3-words.asm
diff --git a/test/full-pipeline/008-3-inst-5-words.asm b/test/full-pipeline/should-pass/008-3-inst-5-words.asm
index c0a33b5..c0a33b5 100644
--- a/test/full-pipeline/008-3-inst-5-words.asm
+++ b/test/full-pipeline/should-pass/008-3-inst-5-words.asm
diff --git a/test/full-pipeline/009-3-inst-5-words-rev.asm b/test/full-pipeline/should-pass/009-3-inst-5-words-rev.asm
index 5592edd..5592edd 100644
--- a/test/full-pipeline/009-3-inst-5-words-rev.asm
+++ b/test/full-pipeline/should-pass/009-3-inst-5-words-rev.asm
diff --git a/test/full-pipeline/010-empty.asm b/test/full-pipeline/should-pass/010-empty.asm
index e69de29..e69de29 100644
--- a/test/full-pipeline/010-empty.asm
+++ b/test/full-pipeline/should-pass/010-empty.asm