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