summaryrefslogtreecommitdiff
path: root/test/awk_test.sh
blob: cf4b3aa9175317b8d9d19bb29f583873636c21ce (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
#! /bin/sh

# test find_modules.sh vs. various awks

# random awks that may be around
awk_list="mawk gawk nawk oawk"
awk_list="$awk_list heirloom-nawk heirloom-oawk"
awk_list="$awk_list original-awk plan9-awk"

fmod=../find_modules.sh
dir=fmod_test
usual_dir=..

rm -rf $dir
mkdir $dir

ok=1
for f in *.c; do
  printf "$f .. "

  # write reference with default 'awk'
  ref=$dir/$f.awk
  $fmod $usual_dir $f > $ref 2>&1

  for a in $awk_list; do
    which $a > /dev/null || continue
    printf "$a "
    out=$dir/$f.$a
    AWK=$a \
    $fmod $usual_dir $f > $out 2>&1
    cmp -s $ref $out || {
      printf "(FAIL) "
      ok=0
    }
  done
  echo ""
done

if test $ok = 1; then
  echo "All OK"
else
  echo "FAIL: not all tests passed"
  exit 1
fi