about summary refs log tree commit diff stats
path: root/run_one_test
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-08-11 23:04:52 -0700
committerKartik Agaram <vc@akkartik.com>2019-08-11 23:04:52 -0700
commit794ceae0af3e9ff613b6a8176ba8851e23f9f6c8 (patch)
treec38ecb6060c91a4b3b6339d7633f506404f69ab0 /run_one_test
parent5914ea1270a8bb4c1d2cb718324115c9a43f5313 (diff)
downloadmu-794ceae0af3e9ff613b6a8176ba8851e23f9f6c8.tar.gz
5509
Diffstat (limited to 'run_one_test')
-rwxr-xr-xrun_one_test22
1 files changed, 22 insertions, 0 deletions
diff --git a/run_one_test b/run_one_test
new file mode 100755
index 00000000..41844d82
--- /dev/null
+++ b/run_one_test
@@ -0,0 +1,22 @@
+#!/usr/bin/env zsh
+# Either run the test with the given name, or rerun the most recently run test.
+# Intended to be called from within Vim. Check out the vimrc.vim file.
+
+if [[ $2 == 'test-'* ]]
+then
+  TEST_NAME=$2 envsubst '$TEST_NAME' < run_one_test.subx > /tmp/run_one_test.subx
+  FILES=$(ls [0-9]*.subx apps/subx-common.subx $1 |sort |uniq)
+  echo $FILES > /tmp/last_run_files
+elif [[ -e /tmp/last_run_files ]]
+then
+  FILES=`cat /tmp/last_run_files`
+else
+  echo "no test found"
+  exit 0  # don't open trace
+fi
+
+set -e
+                                        # turn newlines into spaces
+CFLAGS=$CFLAGS ./subx --debug translate $(echo $FILES) /tmp/run_one_test.subx -o /tmp/a.elf
+
+./subx --debug --trace run /tmp/a.elf