summaryrefslogtreecommitdiffstats
path: root/testsuite/consistency
blob: f6238b387fe21e6a45a8739d8a479f0e9839155a (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
68
69
70
71
72
73
74
75
#! /bin/sh

# Copyright (C) 2007-2011 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

export LANG; LANG=C

lang_map="$abs_top_srcdir/libidu/id-lang.map"

errors=

if mkid -m "$lang_map" $abs_top_srcdir/src; then
    files="`fnid | grep -v single_file_token_bug`"

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

    xtokid_file=$$.xti
    fid_file=$$.fid

    for file in $files
    do
	if fid $file >$fid_file &&
	    xtokid -m "$lang_map" $file |sort -u >$xtokid_file &&
	    cmp -s $xtokid_file $fid_file;
	then
	    echo "Good.  xtokid and fid agree for $file"
	else
	    1>&2 echo "Oops!  xtokid and fid disagree for $file--look in $file.bad-{xti,fid}"
	    mv $xtokid_file $file.bad-xti
	    mv $fid_file $file.bad-fid
	    errors=t
	fi
    done
    rm -f $xtokid_file $fid_file
else
    1>&2 echo "Oops!  mkid failed."
    errors=t
fi

if mkid -m "$lang_map"; then
    echo "Good.  No crash when dealing with single file"
else
    1>&2 echo "Oops!  mkid failed."
    errors=t
fi

case x$errors in
xt) echo "Some checks failed."
    exit 1;;
*)  echo "All checks successful."
    exit 0;;
esac