about summary refs log blame commit diff stats
path: root/subx/run_one_test.sh
blob: 3aa424aeb5d1f0e08d0fe908e495406c82c31f11 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
                  
                                                                               
                                                                      











                                           
 

                                                                  







                                                                                                  
                                   
#!/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
  export TEST_NAME=$2
  echo $TEST_NAME > /tmp/last_test_run
elif [[ -e /tmp/last_test_run ]]
then
  export TEST_NAME=`cat /tmp/last_test_run`
else
  echo "no test found"
  exit 0  # don't open trace
fi

envsubst '$TEST_NAME' < run_one_test.subx > /tmp/run_one_test.subx

if [[ $1 == */* ]]
then
  subx --debug translate [0-9]*.subx apps/subx-common.subx $1 /tmp/run_one_test.subx -o /tmp/a.elf
else
  # don't mention files twice
  subx --debug translate [0-9]*.subx apps/subx-common.subx    /tmp/run_one_test.subx -o /tmp/a.elf
fi

subx --debug --trace run /tmp/a.elf