summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2019-07-29 22:40:00 +1200
committerDavid Phillips <david@sighup.nz>2019-08-03 12:44:12 +1200
commitb717fc6597effed59ebc62aa70acd3a56ebec612 (patch)
treeafee0b7b3c4081b250a5421aec258fcacb5726a1
parent5544ad5c06bee5f562dddd055c571818bc0d0119 (diff)
downloadtoy-cpu-assembler-b717fc6597effed59ebc62aa70acd3a56ebec612.tar.xz
Tidy test runner script
Makes no-clean mode optional, and non-default. By default, we probably want failed test runs not to leave things lying around, since most of test running for now will be for test development. Perhaps once tests are stable, we can switch back to no-clean by default to catch bugs.
-rwxr-xr-xtest/full-pipeline/run-full-pipeline.sh27
1 files changed, 13 insertions, 14 deletions
diff --git a/test/full-pipeline/run-full-pipeline.sh b/test/full-pipeline/run-full-pipeline.sh
index 34d4ff0..4170261 100755
--- a/test/full-pipeline/run-full-pipeline.sh
+++ b/test/full-pipeline/run-full-pipeline.sh
@@ -14,7 +14,7 @@ fail() {
}
pass() {
- echo -e '[\e[0;32mPASS\e[0m] '"$1"
+ echo -e '[\e[1;32mPASS\e[0m] '"$1"
}
clean() {
@@ -22,18 +22,11 @@ clean() {
rm -r "$WORK"
}
-trap clean EXIT
-
-check_expected()
-{
- [ -z "$1" ] && echo WARN: check_expected called with no argument
- if [ -f "$1.expected" ] ; then
- if ! diff "$1.expected" "$1.tmp" >/dev/null; then
- fail "$1 didn't match expected"
- fi
- fi
-}
-
+if [ "$1" == "noclean" ]; then
+ NO_CLEAN=1
+else
+ NO_CLEAN=0
+fi
WORK=$(mktemp -d)
pushd $(dirname "$0") >/dev/null
export ASM="$PWD/../../assembler"
@@ -62,7 +55,7 @@ for first_stage_asm in *.test ; do
fi
# first stage bin and second stage identical for test pass
- if diff "$first_stage_bin" "$second_stage_bin"; then
+ if diff "$first_stage_bin" "$second_stage_bin" >/dev/null; then
pass "$first_stage_asm"
else
fail "$first_stage_asm" "binary mismatch"
@@ -72,4 +65,10 @@ for first_stage_asm in *.test ; do
done
popd >/dev/null
+if [[ "$failure" != "0" && "$NO_CLEAN" == "1" ]] ; then
+ echo "Warning: Leaving work dir $WORK in place. Please remove this yourself"
+else
+ clean
+fi
+
exit "$has_failure"