about summary refs log tree commit diff stats
path: root/run_one_test
blob: 9452524ef92ac113b10c89c23bf2d08111c27399 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/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.
# Unfortunately this only works with Linux at the moment. Some compiler passes
# take too long to run in emulated mode.

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

./debug_translate $(echo $FILES) /tmp/run_one_test.subx
ONLY_CPP=1 CFLAGS=$CFLAGS ./subx --debug --trace run a.elf