blob: 1546b568a9dc3b997b96a38327fcbf77acf181ee (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/bin/sh
: ${M4:=../../src/m4}
test $# -eq 1 || exit 1
FILE=`basename $1 .m4`
test -r $FILE.m4 || exit 1
if head -1 $FILE.m4 | fgrep -w 'dnl noauto' >/dev/null; then
echo "$FILE.test cannot be generated" 1>&2
exit 1
fi
test -d testSubDir || mkdir testSubDir
cat "$FILE.m4" > testSubDir/in
(cd testSubDir; $M4 -I.. -d "in" >out 2>err)
(
cat <<EOFEOF
#!/bin/sh
# $FILE.test is part of the GNU m4 testsuite
. \${srcdir}/defs
cat \${srcdir}/$FILE.m4 >in
EOFEOF
echo
echo 'cat <<\EOF >ok'
cat testSubDir/out
echo EOF
if [ -s testSubDir/err ]; then
echo
echo 'cat <<\EOF >okerr'
sed -e "s, $M4:, m4:," testSubDir/err
echo EOF
fi
echo
echo 'M4PATH=$srcdir:$srcdir/../tests $M4 -d in >out 2>err'
echo 'sed -e "s, ../../src/m4:, m4:," err >sederr && mv sederr err'
if [ -s testSubDir/err ]; then
echo '$CMP -s out ok && $CMP -s err okerr'
else
echo '$CMP -s out ok'
fi
) >$FILE.test.new
if cmp -s $FILE.test.new $FILE.test; then
echo "$FILE.test unchanged" 1>&2
rm -f $FILE.test.new
else
echo "creating $FILE.test" 1>&2
mv $FILE.test.new $FILE.test
chmod +x $FILE.test
fi
rm -f testSubDir/out testSubDir/err
|