]> git.ipfire.org Git - thirdparty/glibc.git/blame - iconvdata/run-iconv-test.sh
Fix typo.
[thirdparty/glibc.git] / iconvdata / run-iconv-test.sh
CommitLineData
480bc727
UD
1#! /bin/sh -f
2# Run available iconv(1) tests.
3# Copyright (C) 1998 Free Software Foundation, Inc.
4# This file is part of the GNU C Library.
5# Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
6#
7# The GNU C Library is free software; you can redistribute it and/or
8# modify it under the terms of the GNU Library General Public License as
9# published by the Free Software Foundation; either version 2 of the
10# License, or (at your option) any later version.
11#
12# The GNU C Library is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15# Library General Public License for more details.
16#
17# You should have received a copy of the GNU Library General Public
18# License along with the GNU C Library; see the file COPYING.LIB. If not,
19# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20# Boston, MA 02111-1307, USA.
21
22codir=$1
23
24# We use always the same temporary file.
25temp1=$codir/iconvdata/iconv-test.xxx
26temp2=$codir/iconvdata/iconv-test.yyy
27
28trap "rm -f $temp1 $temp2" 1 2 3 15
29
30# We must tell the iconv(1) program where the modules we want to use can
31# be found.
32GCONV_PATH=$codir/iconvdata
33export GCONV_PATH
34
35# How the start the iconv(1) program.
36ICONV="$codir/elf/ld.so --library-path $codir $codir/iconv/iconv_prog"
37
38# We read the file named TESTS. All non-empty lines not starting with
39# `#' are interpreted as commands.
40while read from to targets; do
41 # Ignore empty and comment lines.
42 if test -z "$targets" || test "$from" = '#'; then continue; fi
43
44 for t in $targets; do
45 $ICONV -f $from -t $t testdata/$from > $temp1 ||
46 { echo "*** conversion from $from to $t failed"; exit 1; }
f1fa8b68
UD
47 if test -s testdata/$from..$t; then
48 cmp $temp1 testdata/$from..$t >& /dev/null ||
49 { echo "*** $from -> $t conversion failed"; exit 1; }
50 fi
480bc727
UD
51 $ICONV -f $t -t $to -o $temp2 $temp1 ||
52 { echo "*** conversion from $t to $to failed"; exit 1; }
53 test -s $temp1 && cmp testdata/$from $temp2 >& /dev/null ||
f1fa8b68 54 { echo "*** $from -> t -> $to conversion failed"; exit 1; }
8619129f
UD
55 rm -f $temp1 $temp2
56
57 # Now test some bigger text, entirely in ASCII.
58 $ICONV -f $from -t $t testdata/suntzus |
59 $ICONV -f $t -t $to > $temp1 ||
60 { echo "*** conversion $from->$t->$to of suntzus failed"; exit 1; }
61 cmp testdata/suntzus.txt $temp1 ||
62 { echo "*** conversion $from->$t->$to of suntzus incorrect"; exit 1; }
63 rm -f $temp1
480bc727
UD
64
65 # All tests ok.
66 echo "$from -> $t -> $to ok"
480bc727
UD
67 done
68done < TESTS
69
70exit $?
71# Local Variables:
72# mode:shell-script
73# End: