]>
Commit | Line | Data |
---|---|---|
a8dcffb3 AZ |
1 | #!/bin/sh |
2 | # Test if library search path does not terminates with non-directory | |
3 | # components. | |
dff8da6b | 4 | # Copyright (C) 2023-2024 Free Software Foundation, Inc. |
a8dcffb3 AZ |
5 | # This file is part of the GNU C Library. |
6 | # | |
7 | # The GNU C Library is free software; you can redistribute it and/or | |
8 | # modify it under the terms of the GNU Lesser General Public | |
9 | # License as published by the Free Software Foundation; either | |
10 | # version 2.1 of the License, or (at your option) any later version. | |
11 | # | |
12 | # The GNU C Library is distributed in the hope that it will be useful, | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | # Lesser General Public License for more details. | |
16 | # | |
17 | # You should have received a copy of the GNU Lesser General Public | |
18 | # License along with the GNU C Library; if not, see | |
19 | # <https://www.gnu.org/licenses/>. | |
20 | ||
21 | set -e | |
22 | ||
23 | rtld=$1 | |
24 | test_program=$2 | |
25 | test_wrapper_env=$3 | |
26 | run_program_env=$4 | |
27 | # Remove the last space to allow concatenate extra paths. | |
28 | library_path=$(echo $5) | |
29 | objpfx=$6 | |
30 | ||
31 | test_binary=$(basename ${test_program}) | |
32 | test_libpath=${test_binary}-x | |
33 | ||
34 | mkdir -p ${objpfx}/${test_libpath} | |
35 | mv ${objpfx}/tst-non-directory-mod.so ${objpfx}/${test_libpath} | |
36 | ||
37 | # Check with absolute paths. | |
38 | ${test_wrapper_env} \ | |
39 | ${run_program_env} \ | |
40 | $rtld --inhibit-cache \ | |
41 | --library-path \ | |
42 | "$library_path":"${objpfx}"tst-non-directory-invalid:"${objpfx}"${test_libpath} \ | |
43 | $test_program 2>&1 && rc=0 || rc=$? | |
44 | ||
45 | ${test_wrapper_env} \ | |
46 | ${run_program_env} \ | |
47 | $rtld --inhibit-cache \ | |
48 | --library-path \ | |
49 | "$library_path":"${objpfx}"${test_binary}:"${objpfx}"${test_libpath} \ | |
50 | $test_program 2>&1 && rc=0 || rc=$? | |
51 | ||
52 | # Relative paths along with non-existent path in search list. | |
53 | cd "$objpfx" | |
54 | ${test_wrapper_env} \ | |
55 | ${run_program_env} \ | |
56 | $rtld --inhibit-cache \ | |
57 | --library-path \ | |
58 | "$library_path":../elf/tst-non-directory-invalid::../elf/${test_libpath} \ | |
59 | $test_program 2>&1 && rc=0 || rc=$? | |
60 | ||
61 | # Relative paths along with component in the path is not a directory in search list. | |
62 | ${test_wrapper_env} \ | |
63 | ${run_program_env} \ | |
64 | $rtld --inhibit-cache \ | |
65 | --library-path \ | |
66 | "$library_path":../elf/${test_binary}:../elf/${test_libpath} \ | |
67 | $test_program 2>&1 && rc=0 || rc=$? | |
68 | ||
69 | # Relative paths along with non-existent path and a component in the path that is not a directory. | |
70 | ${test_wrapper_env} \ | |
71 | ${run_program_env} \ | |
72 | $rtld --inhibit-cache \ | |
73 | --library-path \ | |
74 | "$library_path":../elf/tst-non-directory-invalid:../elf/${test_binary}:../elf/${test_libpath} \ | |
75 | $test_program 2>&1 && rc=0 || rc=$? | |
76 | ||
77 | exit $rc |