summaryrefslogtreecommitdiff
path: root/checks/check-them
blob: 5dd205b9199fbe675fcfe03b1bf41ac5c6d9a411 (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
#!/bin/sh
# Check GNU m4 against examples from the manual source.
# Copyright (C) 1992 Free Software Foundation, Inc.

out=/tmp/m4-out.$$
err=/tmp/m4-err.$$
xout=/tmp/m4-xout.$$
xerr=/tmp/m4-xerr.$$

trap "rm -f $out $err $xout $xerr; exit 1" 1 2 15

m4 --version

for file
do
  echo "Checking $file"
  m4 -d $file >$out 2>$err

  sed -e '/^dnl @result{}/!d' -e 's///' $file > $xout

  if cmp -s $out $xout; then
    :
  else
    failed="$failed $file:out"
    echo `sed -e 's/^dnl //' -e 1q $file`
    echo "$file: stdout mismatch"
    diff $xout $out
  fi

  sed -e '/^dnl @error{}/!d' -e 's///' $file > $xerr

  if cmp -s $err $xerr; then
    :
  else
    failed="$failed $file:err"
    echo `sed -e 's/^dnl //' -e 1q $file`
    echo "$file: stderr mismatch"
    diff $xerr $err
  fi

done

rm -f $out $err $xout $xerr

echo
if test -z "$failed"; then
  echo "All checks successful"
else
  echo "Failed checks were:"
  echo " $failed"
fi