Debian Codegraph @

runtime/syntax/testdir/tools/maketestdeps

raw
1 #!/bin/bash
2 # This script generates auxiliary recipes for 'make test': e.g. in the case of JAVA,
3 # - a phony target 'java' depends on all of the testdir/input/java*.java
4 # - when the syntax file is changed, timestamps of the JAVA files are updated so that the tests will
5 # be rerun against updated syntax
6 # - when a vim setup file for test, e.g. testdir/input/setup/java_module_info.vim, is changed,
7 # timestamp of the corresponding input, testdir/input/java_module_info.java, is updated
8 #
9 # NOTE: At the moment this script DOES NOT strictly track dependency, like cpp on c, so run
10 # `make clean test` before deployment
11
12 set -eu +f -o pipefail
13
14 cd "$(dirname "$0")"/../..
15 for input in testdir/input/*.*; do
16 dirname=$(dirname "$input")
17 basename=$(basename "$input")
18
19 case "$basename" in
20 vim9_*.*) ft=vim;;
21 *_*.*) ft=${basename%%_*};;
22 *.*) ft=${basename%%.*};;
23 *) exit 1
24 esac
25
26 vimsetup=$dirname/setup/${basename%.*}.vim
27 if [ ! -r "$vimsetup" ]; then
28 vimsetup=
29 fi
30
31 cat << EOF
32 $input: $ft.vim $vimsetup
33 touch -c \$@
34 $basename:: $input
35 $ft:: $basename
36
37 EOF
38 done