Blame localedata/tst-locale.sh

Packit 6c4009
#!/bin/sh
Packit 6c4009
# Testing the implementation of localedata.
Packit 6c4009
# Copyright (C) 1998-2018 Free Software Foundation, Inc.
Packit 6c4009
# This file is part of the GNU C Library.
Packit 6c4009
# Contributed by Andreas Jaeger, <aj@arthur.rhein-neckar.de>, 1998.
Packit 6c4009
Packit 6c4009
# The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
# modify it under the terms of the GNU Lesser General Public
Packit 6c4009
# License as published by the Free Software Foundation; either
Packit 6c4009
# version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
# The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
# Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
# You should have received a copy of the GNU Lesser General Public
Packit 6c4009
# License along with the GNU C Library; if not, see
Packit 6c4009
# <http://www.gnu.org/licenses/>.
Packit 6c4009
Packit 6c4009
set -e
Packit 6c4009
Packit 6c4009
common_objpfx=$1; shift
Packit 6c4009
localedef_before_env=$1; shift
Packit 6c4009
run_program_env=$1; shift
Packit 6c4009
localedef_after_env=$1; shift
Packit 6c4009
Packit 6c4009
test_locale ()
Packit 6c4009
{
Packit 6c4009
    charmap=$1
Packit 6c4009
    input=$2
Packit 6c4009
    out=$3
Packit 6c4009
    rep=$4
Packit 6c4009
    if test $rep; then
Packit 6c4009
      rep="--repertoire-map $rep"
Packit 6c4009
    fi
Packit 6c4009
    # We expect the test locales to fail with warnings, they are mostly
Packit 6c4009
    # incomplete and used for testing purposes, but that is OK.
Packit 6c4009
    ret=0
Packit 6c4009
    ${localedef_before_env} \
Packit 6c4009
    ${run_program_env} \
Packit 6c4009
    I18NPATH=. \
Packit 6c4009
    ${localedef_after_env} --quiet -c -f $charmap -i $input \
Packit 6c4009
      ${rep} ${common_objpfx}localedata/$out || ret=$?
Packit 6c4009
    # Any error greater than one means we ran into an implementation
Packit 6c4009
    # defined limit or saw an error that caused the output not to
Packit 6c4009
    # be written, or lastly saw a fatal error that terminated
Packit 6c4009
    # localedef.
Packit 6c4009
    if [ $ret -gt 1 ]; then
Packit 6c4009
	echo "Charmap: \"${charmap}\" Inputfile: \"${input}\"" \
Packit 6c4009
	     "Outputdir: \"${out}\" failed"
Packit 6c4009
	exit 1
Packit 6c4009
    else
Packit 6c4009
	echo -n "locale $out generated succesfully"
Packit 6c4009
        if [ $ret -eq 1 ]; then
Packit 6c4009
	    echo " (with warnings)"
Packit 6c4009
        else
Packit 6c4009
	    echo " (without warnings)"
Packit 6c4009
        fi
Packit 6c4009
    fi
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
test_locale IBM437 de_DE de_DE.437
Packit 6c4009
test_locale tests/test1.cm tests/test1.def test1
Packit 6c4009
test_locale tests/test2.cm tests/test2.def test2
Packit 6c4009
test_locale tests/test3.cm tests/test3.def test3
Packit 6c4009
test_locale tests/test4.cm tests/test4.def test4
Packit 6c4009
test_locale tests/test5.cm tests/test5.def test5 tests/test5.ds
Packit 6c4009
test_locale tests/test6.cm tests/test6.def test6 tests/test6.ds
Packit 6c4009
test_locale tests/test7.cm tests/test7.def test7
Packit 6c4009
Packit 6c4009
exit 0
Packit 6c4009
Packit 6c4009
# Local Variables:
Packit 6c4009
#  mode:shell-script
Packit 6c4009
# End: