2 # Test that ldconfig -p prints something useful.
3 # Copyright (C) 2023 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
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.
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.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with the GNU C Library; if not, see
18 # <https://www.gnu.org/licenses/>.
20 # Check that the newly built ldconfig -p can dump the system
21 # /etc/ld.so.cache file. This should always work even if the ABIs are
22 # not compatible, except in a cross-endian build (that presumably
23 # involves emulation when running ldconfig).
30 if ! test -r "${sysconfdir}/ld.so.cache"; then
31 echo "warning: ${sysconfdir}/ld.so.cache does not exist, test skipped"
35 testout
="${common_objpfx}elf/tst-ldconfig-p.out"
41 ${common_objpfx}elf
/ldconfig
-p \
42 $testroot/lib
>>"$testout" 2>>"$testout"
44 echo "info: ldconfig exit status: $status" >>"$testout"
49 if head -n 1 "$testout" | \
50 grep -q "libs found in cache \`${sysconfdir}/ld.so.cache'\$" ; then
51 echo "info: initial string found" >>"$testout"
53 echo "error: initial string not found" >>"$testout"
56 if grep -q "^ libc\.so\..* => " "$testout"; then
57 echo "info: libc.so.* string found" >>"$testout"
59 echo "error: libc.so.* string not found" >>"$testout"
64 if head -n 1 "$testout" | \
65 grep -q ": Cache file has wrong endianness\.$" ; then
66 echo "info: cache file has wrong endianess" >> "$testout"
68 echo "error: unexpected ldconfig error message" >> "$testout"
73 echo "error: unexpected exit status" >> "$testout"