| 1 | #! /bin/sh |
| 2 | |
| 3 | # Copyright (C) 2007-2020 Free Software Foundation, Inc. |
| 4 | |
| 5 | # This program is free software; you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # the Free Software Foundation; either version 3 of the License, or |
| 8 | # (at your option) any later version. |
| 9 | |
| 10 | # This program is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | |
| 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | export LANG; LANG=C |
| 19 | |
| 20 | lang_map="$abs_top_srcdir/libidu/id-lang.map" |
| 21 | |
| 22 | errors= |
| 23 | |
| 24 | if mkid -m "$lang_map" $abs_top_srcdir/src; then |
| 25 | files="`fnid | grep -v single_file_token_bug`" |
| 26 | |
| 27 | if xtokid -m "$lang_map" $files |sort -u >ID.xti && |
| 28 | lid |sed -e 's/[ ].*//' |sort -u >ID.lid && |
| 29 | cmp -s ID.xti ID.lid |
| 30 | then |
| 31 | rm -f ID.xti ID.lid |
| 32 | echo "Good. xtokid and lid agree." |
| 33 | else |
| 34 | mv ID.xti ID.bad-xti |
| 35 | mv ID.lid ID.bad-lid |
| 36 | 1>&2 echo "Oops! xtokid and lid disagree--look in ID.bad-{xti,lid}" |
| 37 | errors=t |
| 38 | fi |
| 39 | |
| 40 | xtokid_file=$$.xti |
| 41 | fid_file=$$.fid |
| 42 | |
| 43 | for file in $files |
| 44 | do |
| 45 | if fid $file >$fid_file && |
| 46 | xtokid -m "$lang_map" $file |sort -u >$xtokid_file && |
| 47 | cmp -s $xtokid_file $fid_file; |
| 48 | then |
| 49 | echo "Good. xtokid and fid agree for $file" |
| 50 | else |
| 51 | 1>&2 echo "Oops! xtokid and fid disagree for $file--look in $file.bad-{xti,fid}" |
| 52 | mv $xtokid_file $file.bad-xti |
| 53 | mv $fid_file $file.bad-fid |
| 54 | errors=t |
| 55 | fi |
| 56 | done |
| 57 | rm -f $xtokid_file $fid_file |
| 58 | else |
| 59 | 1>&2 echo "Oops! mkid failed." |
| 60 | errors=t |
| 61 | fi |
| 62 | |
| 63 | if mkid -m "$lang_map"; then |
| 64 | echo "Good. No crash when dealing with single file" |
| 65 | else |
| 66 | 1>&2 echo "Oops! mkid failed." |
| 67 | errors=t |
| 68 | fi |
| 69 | |
| 70 | case x$errors in |
| 71 | xt) echo "Some checks failed." |
| 72 | exit 1;; |
| 73 | *) echo "All checks successful." |
| 74 | exit 0;; |
| 75 | esac |