Blame locale/tst-locale-locpath.sh

Packit Service d16070
#!/bin/sh
Packit Service d16070
# Test that locale prints LOCPATH on failure.
Packit Service d16070
# Copyright (C) 2019 Free Software Foundation, Inc.
Packit Service d16070
# This file is part of the GNU C Library.
Packit Service d16070
Packit Service d16070
# The GNU C Library is free software; you can redistribute it and/or
Packit Service d16070
# modify it under the terms of the GNU Lesser General Public
Packit Service d16070
# License as published by the Free Software Foundation; either
Packit Service d16070
# version 2.1 of the License, or (at your option) any later version.
Packit Service d16070
Packit Service d16070
# The GNU C Library is distributed in the hope that it will be useful,
Packit Service d16070
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service d16070
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service d16070
# Lesser General Public License for more details.
Packit Service d16070
Packit Service d16070
# You should have received a copy of the GNU Lesser General Public
Packit Service d16070
# License along with the GNU C Library; if not, see
Packit Service d16070
# <http://www.gnu.org/licenses/>.
Packit Service d16070
Packit Service d16070
set -ex
Packit Service d16070
Packit Service d16070
common_objpfx=$1
Packit Service d16070
test_wrapper_env=$2
Packit Service d16070
run_program_env=$3
Packit Service d16070
Packit Service d16070
LIBPATH="$common_objpfx"
Packit Service d16070
Packit Service d16070
testroot="${common_objpfx}locale/tst-locale-locpath-directory"
Packit Service d16070
cleanup () {
Packit Service d16070
    rm -rf "$testroot"
Packit Service d16070
}
Packit Service d16070
trap cleanup 0
Packit Service d16070
Packit Service d16070
rm -rf "$testroot"
Packit Service d16070
mkdir -p $testroot
Packit Service d16070
Packit Service d16070
unset LANG
Packit Service d16070
Packit Service d16070
${test_wrapper_env} \
Packit Service d16070
${run_program_env} LC_ALL=invalid-locale LOCPATH=does-not-exist \
Packit Service d16070
${common_objpfx}elf/ld.so --library-path "$LIBPATH" \
Packit Service d16070
  "${common_objpfx}locale/locale" \
Packit Service d16070
  > "$testroot/stdout" 2> "$testroot/stderr"
Packit Service d16070
Packit Service d16070
echo "* standard error"
Packit Service d16070
cat "$testroot/stderr"
Packit Service d16070
echo "* standard output"
Packit Service d16070
cat "$testroot/stdout"
Packit Service d16070
Packit Service d16070
cat > "$testroot/stderr-expected" <
Packit Service d16070
${common_objpfx}locale/locale: Cannot set LC_CTYPE to default locale: No such file or directory
Packit Service d16070
${common_objpfx}locale/locale: Cannot set LC_MESSAGES to default locale: No such file or directory
Packit Service d16070
${common_objpfx}locale/locale: Cannot set LC_ALL to default locale: No such file or directory
Packit Service d16070
warning: The LOCPATH variable is set to "does-not-exist"
Packit Service d16070
EOF
Packit Service d16070
Packit Service d16070
cat > "$testroot/stdout-expected" <
Packit Service d16070
LANG=
Packit Service d16070
LC_CTYPE="invalid-locale"
Packit Service d16070
LC_NUMERIC="invalid-locale"
Packit Service d16070
LC_TIME="invalid-locale"
Packit Service d16070
LC_COLLATE="invalid-locale"
Packit Service d16070
LC_MONETARY="invalid-locale"
Packit Service d16070
LC_MESSAGES="invalid-locale"
Packit Service d16070
LC_PAPER="invalid-locale"
Packit Service d16070
LC_NAME="invalid-locale"
Packit Service d16070
LC_ADDRESS="invalid-locale"
Packit Service d16070
LC_TELEPHONE="invalid-locale"
Packit Service d16070
LC_MEASUREMENT="invalid-locale"
Packit Service d16070
LC_IDENTIFICATION="invalid-locale"
Packit Service d16070
LC_ALL=invalid-locale
Packit Service d16070
EOF
Packit Service d16070
Packit Service d16070
errors=0
Packit Service d16070
if ! cmp -s "$testroot/stderr-expected" "$testroot/stderr" ; then
Packit Service d16070
    echo "error: standard error not correct"
Packit Service d16070
    errors=1
Packit Service d16070
fi
Packit Service d16070
if ! cmp -s "$testroot/stdout-expected" "$testroot/stdout" ; then
Packit Service d16070
    echo "error: standard output not correct"
Packit Service d16070
    errors=1
Packit Service d16070
fi
Packit Service d16070
exit $errors