From eada7e30a048caffdbcd2bc992efee511ffd5e09 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 29 Jun 2019 21:02:11 -0700 Subject: . When rerunning most recently run test, also load the same files as before. Try the following commands in sequence: $ ./run_one_test.sh 056trace.subx test-compute-addresses # 1 0 error: missing reference to global 'test-compute-addresses' $ ./run_one_test.sh apps/survey.subx test-compute-addresses # 2 $ ./run_one_test.sh 056trace.subx trace # run previous test # 3 Now command 3 will work, and it will behave identically to command 2. This way I can switch to another file in Vim and hit `\t` in a random place in the file and still have the previously run test be rerun. --- subx/run_one_test.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/subx/run_one_test.sh b/subx/run_one_test.sh index ded3e6e5..c81bd0c4 100755 --- a/subx/run_one_test.sh +++ b/subx/run_one_test.sh @@ -5,14 +5,17 @@ if [[ $2 == 'test-'* ]] then TEST_NAME=$2 envsubst '$TEST_NAME' < run_one_test.subx > /tmp/run_one_test.subx -elif [[ ! -e /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 -FILES=$(ls [0-9]*.subx apps/subx-common.subx $1 |sort |uniq) # turn newlines into spaces CFLAGS=$CFLAGS subx --debug translate $(echo $FILES) /tmp/run_one_test.subx -o /tmp/a.elf -- cgit 1.4.1-2-gfad0