]> git.ipfire.org Git - thirdparty/glibc.git/blame - locale/tst-locale-locpath.sh
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / locale / tst-locale-locpath.sh
CommitLineData
e485b2b6
FW
1#!/bin/sh
2# Test that locale prints LOCPATH on failure.
3# Copyright (C) 2019 Free Software Foundation, Inc.
4# This file is part of the GNU C Library.
5
6# The GNU C Library is free software; you can redistribute it and/or
7# modify it under the terms of the GNU Lesser General Public
8# License as published by the Free Software Foundation; either
9# version 2.1 of the License, or (at your option) any later version.
10
11# The GNU C Library is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14# Lesser General Public License for more details.
15
16# You should have received a copy of the GNU Lesser General Public
17# License along with the GNU C Library; if not, see
5a82c748 18# <https://www.gnu.org/licenses/>.
e485b2b6
FW
19
20set -ex
21
22common_objpfx=$1
23test_wrapper_env=$2
24run_program_env=$3
25
26LIBPATH="$common_objpfx"
27
28testroot="${common_objpfx}locale/tst-locale-locpath-directory"
29cleanup () {
30 rm -rf "$testroot"
31}
32trap cleanup 0
33
34rm -rf "$testroot"
35mkdir -p $testroot
36
37unset LANG
38
39${test_wrapper_env} \
40${run_program_env} LC_ALL=invalid-locale LOCPATH=does-not-exist \
41${common_objpfx}elf/ld.so --library-path "$LIBPATH" \
42 "${common_objpfx}locale/locale" \
43 > "$testroot/stdout" 2> "$testroot/stderr"
44
45echo "* standard error"
46cat "$testroot/stderr"
47echo "* standard output"
48cat "$testroot/stdout"
49
50cat > "$testroot/stderr-expected" <<EOF
51${common_objpfx}locale/locale: Cannot set LC_CTYPE to default locale: No such file or directory
52${common_objpfx}locale/locale: Cannot set LC_MESSAGES to default locale: No such file or directory
53${common_objpfx}locale/locale: Cannot set LC_ALL to default locale: No such file or directory
54warning: The LOCPATH variable is set to "does-not-exist"
55EOF
56
57cat > "$testroot/stdout-expected" <<EOF
58LANG=
59LC_CTYPE="invalid-locale"
60LC_NUMERIC="invalid-locale"
61LC_TIME="invalid-locale"
62LC_COLLATE="invalid-locale"
63LC_MONETARY="invalid-locale"
64LC_MESSAGES="invalid-locale"
65LC_PAPER="invalid-locale"
66LC_NAME="invalid-locale"
67LC_ADDRESS="invalid-locale"
68LC_TELEPHONE="invalid-locale"
69LC_MEASUREMENT="invalid-locale"
70LC_IDENTIFICATION="invalid-locale"
71LC_ALL=invalid-locale
72EOF
73
74errors=0
75if ! cmp -s "$testroot/stderr-expected" "$testroot/stderr" ; then
76 echo "error: standard error not correct"
77 errors=1
78fi
79if ! cmp -s "$testroot/stdout-expected" "$testroot/stdout" ; then
80 echo "error: standard output not correct"
81 errors=1
82fi
83exit $errors