]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - 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
CommitLineData
4a94e368 1# Copyright 2010-2022 Free Software Foundation, Inc.
569b05a5
JK
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
27c9e813
PA
16if [skip_shlib_tests] {
17 return
18}
19
20# The testcase assumes the target can access the OBJDIR.
21if [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.
079670b9 28if [use_gdb_stub] {
569b05a5
JK
29 return
30}
31
32set testfile "solib-nodir"
33# Arbitrary file, possibly not containing main, even an empty one.
34set srclibfile foo.c
35# Arbitrary file containing main.
36set srcfile start.c
37set binlibfilebase ${testfile}.so
0ab77f5f 38set binlibfiledir [standard_output_file {}]
569b05a5
JK
39set binlibfile ${binlibfiledir}/${binlibfilebase}
40set executable ${testfile}
0ab77f5f
TT
41set objfile [standard_output_file ${executable}.o]
42set binfile [standard_output_file ${executable}]
569b05a5
JK
43
44# build the first test case
4c93b1db 45if { [get_compiler_info]
d8b34041 46 || [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" "${binlibfile}" [list debug ldflags=-Wl,-soname,${binlibfilebase}]] != ""
569b05a5
JK
47 || [gdb_gnu_strip_debug $binlibfile]
48 || [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != ""
49 || [gdb_compile "${objfile} ${binlibfile}" "${binfile}" executable {}] != "" } {
5b362f04 50 untested "failed to compile"
569b05a5
JK
51 return -1
52}
53
54clean_restart $executable
d9019901 55gdb_load_shlib ${binlibfile}
569b05a5
JK
56
57gdb_test_no_output "set env LD_LIBRARY_PATH=:"
27c9e813
PA
58gdb_test_no_output "set cwd ${binlibfiledir}" \
59 "set cwd OBJDIR/${subdir}"
569b05a5
JK
60
61set test "library loaded"
62if [runto_main] {
63 pass $test
64} else {
65 fail $test
66}