1228753Smm# Copyright (C) 2013-2020 Free Software Foundation, Inc.
2228753Smm
3228753Smm# This program is free software; you can redistribute it and/or modify
4228753Smm# it under the terms of the GNU General Public License as published by
5228753Smm# the Free Software Foundation; either version 3 of the License, or
6228753Smm# (at your option) any later version.
7228753Smm#
8228753Smm# This program is distributed in the hope that it will be useful,
9228753Smm# but WITHOUT ANY WARRANTY; without even the implied warranty of
10228753Smm# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11228753Smm# GNU General Public License for more details.
12228753Smm#
13228753Smm# You should have received a copy of the GNU General Public License
14228753Smm# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15228753Smm
16228753Smmstandard_testfile .c realname-expand-real.c
17228753Smm
18228753Smmif [is_remote host] {
19228753Smm    unsupported "compiling on a remote host does not support a filename with directory."
20228753Smm    return 0
21228753Smm}
22228753Smm
23228753Smmset srcdirabs [file join [pwd] $srcdir]
24228753Smmset srcfilelink [standard_output_file realname-expand-link.c]
25228753Smm
26228763Smmremote_exec build "ln -sf ${srcdirabs}/${subdir}/${srcfile2} $srcfilelink"
27228753Smm
28228753Smmif { [file type $srcfilelink] != "link" } {
29228753Smm    unsupported "target directory cannot have symbolic links"
30228753Smm    return -1
31228753Smm}
32228753Smm
33228753Smmif { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcfilelink}" "${binfile}" \
34228753Smm		  executable {debug}] != "" } {
35228753Smm    untested "failed to compile"
36232153Smm    return -1
37238856Smm}
38232153Smm
39228753Smmclean_restart ${testfile}
40228753Smm
41228753Smmgdb_test_no_output "set basenames-may-differ on"
42299529Smm
43299529Smmgdb_test "rbreak realname-expand-real.c:func" "^rbreak realname-expand-real.c:func\r\nBreakpoint 1 at 0x\[0-9a-f\]+: file \[^\r\n\]*/realname-expand-link\\.c, line \[0-9\]+\\.\r\nvoid func\\(void\\);"
44299529Smm
45228753Smmclean_restart ${testfile}
46228753Smm
47228753Smmgdb_test_no_output "set basenames-may-differ on"
48228753Smm
49228753Smmgdb_test "break realname-expand-real.c:func" "^break realname-expand-real.c:func\r\nBreakpoint 1 at 0x\[0-9a-f\]+: file \[^\r\n\]*/realname-expand-link\\.c, line \[0-9\]+\\."
50228753Smm