]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/solib-nodir.exp
Automatic Copyright Year update after running gdb/copyright.py
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / solib-nodir.exp
1 # Copyright 2010-2022 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>. */
15
16 if [skip_shlib_tests] {
17 return
18 }
19
20 # The testcase assumes the target can access the OBJDIR.
21 if [is_remote target] {
22 return
23 }
24
25 # We need to be able to influence the target's environment and working
26 # directory. Can't do that if when we connect the inferior is already
27 # running.
28 if [use_gdb_stub] {
29 return
30 }
31
32 set testfile "solib-nodir"
33 # Arbitrary file, possibly not containing main, even an empty one.
34 set srclibfile foo.c
35 # Arbitrary file containing main.
36 set srcfile start.c
37 set binlibfilebase ${testfile}.so
38 set binlibfiledir [standard_output_file {}]
39 set binlibfile ${binlibfiledir}/${binlibfilebase}
40 set executable ${testfile}
41 set objfile [standard_output_file ${executable}.o]
42 set binfile [standard_output_file ${executable}]
43
44 # build the first test case
45 if { [get_compiler_info]
46 || [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" "${binlibfile}" [list debug ldflags=-Wl,-soname,${binlibfilebase}]] != ""
47 || [gdb_gnu_strip_debug $binlibfile]
48 || [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != ""
49 || [gdb_compile "${objfile} ${binlibfile}" "${binfile}" executable {}] != "" } {
50 untested "failed to compile"
51 return -1
52 }
53
54 clean_restart $executable
55 gdb_load_shlib ${binlibfile}
56
57 gdb_test_no_output "set env LD_LIBRARY_PATH=:"
58 gdb_test_no_output "set cwd ${binlibfiledir}" \
59 "set cwd OBJDIR/${subdir}"
60
61 set test "library loaded"
62 if [runto_main] {
63 pass $test
64 } else {
65 fail $test
66 }