2 # Copyright (C) 2000 Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
4 # Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Library General Public License as
8 # published by the Free Software Foundation; either version 2 of the
9 # License, or (at your option) any later version.
11 # The GNU C Library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Library General Public License for more details.
16 # You should have received a copy of the GNU Library General Public
17 # License along with the GNU C Library; see the file COPYING.LIB. If not,
18 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 # Boston, MA 02111-1307, USA.
21 # Checks that the iconv() implementation (in both directions) for a
22 # stateless encoding agrees with the charmap table.
29 GCONV_PATH
=${common_objpfx}iconvdata
37 ${SHELL} tst-table-charmap.sh
${charmap:-$charset} \
38 < ..
/localedata
/charmaps
/${charmap:-$charset} \
39 > ${objpfx}tst-
${charset}.charmap.table
41 # Precompute expected differences between the two iconv directions.
42 if test ${charset} = EUC-TW
; then
43 irreversible
=${objpfx}tst-
${charset}.irreversible
44 grep '^0x8EA1' ${objpfx}tst-${charset}.charmap.table > ${irreversible}
46 irreversible
=${charset}.irreversible
49 # iconv in one direction.
50 ${common_objpfx}elf
/ld.so
--library-path $common_objpfx \
51 ${objpfx}tst-table-from
${charset} \
52 > ${objpfx}tst-
${charset}.table
54 # iconv in the other direction.
55 ${common_objpfx}elf
/ld.so
--library-path $common_objpfx \
56 ${objpfx}tst-table-to
${charset} |
sort \
57 > ${objpfx}tst-
${charset}.inverse.table
59 # Difference between the two iconv directions.
60 diff ${objpfx}tst-${charset}.table ${objpfx}tst-${charset}.inverse.table | \
61 grep '^[<>]' |
sed -e 's,^. ,,' > ${objpfx}tst-
${charset}.irreversible.table
63 # Check 1: charmap and iconv forward should be identical.
64 cmp -s ${objpfx}tst-${charset}.charmap.table ${objpfx}tst-${charset}.table ||
67 # Check 2: the difference between the two iconv directions.
68 if test -f ${irreversible}; then
69 cat ${objpfx}tst-${charset}.charmap.table ${irreversible} |
sort |
uniq -u \
70 > ${objpfx}tst-
${charset}.tmp.table
71 cmp -s ${objpfx}tst-${charset}.tmp.table ${objpfx}tst-${charset}.inverse.table ||
74 cmp -s ${objpfx}tst-${charset}.table ${objpfx}tst-${charset}.inverse.table ||