* iconvdata/run-iconv-test.sh: Improve test output a bit to allow
	identifying errors more easily.
This commit is contained in:
Ulrich Drepper 1999-12-28 07:12:35 +00:00
parent cb852d06a9
commit 822078f617
2 changed files with 27 additions and 8 deletions

View File

@ -1,5 +1,8 @@
1999-12-27 Ulrich Drepper <drepper@cygnus.com>
* iconvdata/run-iconv-test.sh: Improve test output a bit to allow
identifying errors more easily.
* iconvdata/testdata/EUC-CN..UTF8: New file.
* iconvdata/testdata/GBK..UTF8: New file.

View File

@ -1,6 +1,6 @@
#! /bin/sh -f
# Run available iconv(1) tests.
# Copyright (C) 1998 Free Software Foundation, Inc.
# Copyright (C) 1998, 1999 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
#
@ -39,6 +39,13 @@ LIBPATH=$codir:$codir/iconvdata
ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
$codir/iconv/iconv_prog'
# Which echo?
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
ac_n=-n ac_c= ac_t=
else
ac_n= ac_c='\c' ac_t=
fi
# We read the file named TESTS. All non-empty lines not starting with
# `#' are interpreted as commands.
failed=0
@ -50,41 +57,50 @@ while read from to subset targets; do
PROG=`eval echo $ICONV`
for t in $targets; do
echo $ac_n "test data: $from -> $to $ac_c"
$PROG -f $from -t $t testdata/$from > $temp1 ||
{ echo "*** conversion from $from to $t failed"; failed=1; continue; }
echo $ac_n "OK$ac_c"
if test -s testdata/$from..$t; then
cmp $temp1 testdata/$from..$t > /dev/null 2>&1 ||
{ echo "*** $from -> $t conversion failed"; failed=1; continue; }
{ echo "/FAILED"; failed=1; continue; }
echo $ac_n "/OK$ac_c"
fi
echo $ac_n " -> $from $ac_c"
$PROG -f $t -t $to -o $temp2 $temp1 ||
{ echo "*** conversion from $t to $to failed"; failed=1; continue; }
echo $ac_n "OK$ac_c"
test -s $temp1 && cmp testdata/$from $temp2 > /dev/null 2>&1 ||
{ echo "*** $from -> t -> $to conversion failed"; failed=1; continue; }
echo "/OK"
rm -f $temp1 $temp2
# Now test some bigger text, entirely in ASCII. If ASCII is no subset
# of the coded character set we test we convert the test to this
# coded character set. Otherwise we convert to all the TARGETS.
if test $subset = Y; then
echo $ac_n " suntzu: $from -> $to $ac_c"
$PROG -f $from -t $t testdata/suntzus |
$PROG -f $t -t $to > $temp1 ||
{ echo "*** conversion $from->$t->$to of suntzus failed"; failed=1;
{ echo "FAILED"; failed=1;
continue; }
echo $ac_n "OK$ac_c"
cmp testdata/suntzus $temp1 ||
{ echo "*** conversion $from->$t->$to of suntzus incorrect";
{ echo "/FAILED";
failed=1; continue; }
else
echo $ac_n "; suntzu: $from -> ASCII $ac_c"
$PROG -f ASCII -t $to testdata/suntzus |
$PROG -f $to -t ASCII > $temp1 ||
{ echo "*** conversion ASCII->$to->ASCII of suntzus failed";
{ echo "FAILED";
failed=1; continue; }
echo $ac_n "OK$ac_c"
cmp testdata/suntzus $temp1 ||
{ echo "*** conversion ASCII->$to->ASCII of suntzus incorrect";
{ echo "/FAILED";
failed=1; continue; }
fi
echo "/OK"
rm -f $temp1
# All tests ok.
echo "$from -> $t -> $to ok"
done
done < TESTS