Blame locale/tst-locale-locpath.sh

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