summaryrefslogtreecommitdiffstats
path: root/idtest
blob: b513e2a1fbfea69e697903d325c32c5c8c13d7f2 (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
66
67
#!/bin/sh

export LANG; LANG=C

case $# in
0) exec make idtest-real;;
esac

srcdir=$1
buildir=$2
PATH=$buildir/src:$PATH

f_ID="-f $buildir/ID"

files="`find $srcdir -name \*.h;
	find $srcdir -name \*.c |egrep -v 'lib/ansi2knr\.c$'`"

cmd="mkid $f_ID -m $srcdir/lib/language.map $files"
echo $cmd
eval $cmd

errors=

if idx $files |sort -u >ID.idx &&
    lid $idfile_arg |sed -e 's/[ 	].*//' |sort -u >ID.lid &&
    cmp -s ID.idx ID.lid
then
    rm -f ID.idx ID.lid
    echo "Good.  idx and lid agree."
else
    mv ID.idx ID.bad-idx
    mv ID.fid ID.bad-fid
    1>&2 echo "Oops!  idx and lid disagree--look in ID.bad-{idx,lid}"
    errors=t
fi

idx_file=$$.idx
fid_file=$$.fid

for file in $files
do
    case x$file in
    x-*) scan_args="$scan_args $file"
	 continue;;
    esac
    if fid $idfile_arg $file >$fid_file &&
	idx $scan_args $file |sort -u >$idx_file &&
	cmp -s $idx_file $fid_file;
    then
	echo "Good.  idx and fid agree for $file"
    else
	1>&2 echo "Oops!  idx and fid disagree for $file--look in $file.bad-{idx,fid}"
	mv $idx_file $file.bad-idx
	mv $fid_file $file.bad-fid
	errors=t
    fi
done
rm -f $idx_file $fid_file

case x$errors in
xt) echo "Some checks failed."
    echo "mkid and friends are broken--boo hoo!"
    exit 1;;
*)  echo "All checks successful."
    echo "mkid and friends are happy!"
    exit 0;;
esac