Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.base / exe-lock.exp
blob4e6958339020a1b8e2c4d3b17d8c6bf7e677a571
1 # Copyright 2009-2023 Free Software Foundation, Inc.
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.
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.
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/>.
16 # The intent of this testcase is to verify that GDB does not keep
17 # a filesystem lock on the executable file once the executable
18 # is no longer running.
20 standard_testfile arrayidx.c
21 # $EXEEXT suffix is needed here, because otherwise, Windows targets
22 # don't find the $binfile for 'file delete $binfile'.
23 append binfile $EXEEXT
25 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
26     untested "failed to compile"
27     return -1
30 clean_restart ${binfile}
32 # Sanity-check: Verify that the executable exists. This is just to
33 # make sure that, when we verify later that the file does not exist,
34 # it really has been deleted.
35 if { ! [file exists $binfile] } {
36     fail "executable does not exist (${binfile})"
37     return -1
38     }
40 if {![runto_main]} {
41     return
44 gdb_continue_to_end
46 # Try deleting the executable file, now that the program has exited,
47 # and make sure that the deletion worked by verifying that the exe
48 # is no longer there (the "file delete" tcl command does not return
49 # any status, apparently).
50 file delete $binfile
51 if { [file exists $binfile] } {
52     fail "executable still exists (${binfile})"
53     }