From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 2EDF43858CDB; Fri, 7 Oct 2022 16:08:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2EDF43858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665158884; bh=vU8/E3nETjPWhecwhBcoiypjM08uO8N2zPcBdDgvHNc=; h=From:To:Subject:Date:From; b=QuS1oQMhExMh0pye8qqaxeWStzMhTZ3Ui9DpTKfPTaKQWp2AVwUsyGSdz3HjiYeNd cfgIVy/psVc7o9W+uWNWYl9VgQkA2kBFT1gPGFJshrXcquk9jgfmxNekb5J526VQfB lYjX1d46Iy65F11L7XORsSZxi8hsfgqX2sifiN24= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Handle host cleanfiles X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 8c7cb01a296c3f91372505b67be76ca41f0665a6 X-Git-Newrev: 7808a1f7f68cb38f66cf44bb91faae29b0dbfedd Message-Id: <20221007160804.2EDF43858CDB@sourceware.org> Date: Fri, 7 Oct 2022 16:08:04 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7808a1f7f68c= b38f66cf44bb91faae29b0dbfedd commit 7808a1f7f68cb38f66cf44bb91faae29b0dbfedd Author: Tom de Vries Date: Fri Oct 7 18:08:00 2022 +0200 [gdb/testsuite] Handle host cleanfiles =20 When running test-case gdb.server/abspath.exp with host board local-remote-host-notty, I get: ... $ git sti ... deleted: gdb/testsuite/gdb.xml/trivial.xml ... =20 This happens as follows. The test-case calls skip_gdbserver_test, whic= h calls gdb_skip_xml_test, which does: ... set xml_file [gdb_remote_download host "${srcdir}/gdb.xml/trivial.x= ml"] ... =20 Then proc gdb_remote_download appends $xml_file (which for this particu= lar host board happens to be ${srcdir}/gdb.xml/trivial.xml) to cleanfiles, = which ends up being handled in gdb_finish by: ... eval remote_file target delete $cleanfiles ... =20 The problem is that a host file is deleted using target delete. =20 Fix this by splitting cleanfiles up in cleanfiles_target and cleanfiles= _host. =20 Tested on x86_64-linux. Diff: --- gdb/testsuite/lib/gdb.exp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 99a6de6f724..44cc28b3005 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5572,10 +5572,14 @@ proc gdb_remote_download {dest fromfile {tofile {}}= } { =20 if {[is_remote $dest]} { # When the DEST is remote, we simply send the file to DEST. - global cleanfiles + global cleanfiles_target cleanfiles_host =20 set destname [remote_download $dest $fromfile $tofile] - lappend cleanfiles $destname + if { $dest =3D=3D "target" } { + lappend cleanfiles_target $destname + } elseif { $dest =3D=3D "host" } { + lappend cleanfiles_host $destname + } =20 return $destname } else { @@ -5722,7 +5726,8 @@ proc default_gdb_init { test_file_name } { global gdb_wrapper_initialized global gdb_wrapper_target global gdb_test_file_name - global cleanfiles + global cleanfiles_target + global cleanfiles_host global pf_prefix =20 # Reset the timeout value to the default. This way, any testcase @@ -5838,7 +5843,8 @@ proc default_gdb_init { test_file_name } { global gdb_instances set gdb_instances 0 =20 - set cleanfiles {} + set cleanfiles_target {} + set cleanfiles_host {} =20 set gdb_test_file_name [file rootname [file tail $test_file_name]] =20 @@ -6150,7 +6156,8 @@ proc gdb_init { args } { proc gdb_finish { } { global gdbserver_reconnect_p global gdb_prompt - global cleanfiles + global cleanfiles_target + global cleanfiles_host global known_globals =20 if { [info procs ::gdb_tcl_unknown] !=3D "" } { @@ -6162,9 +6169,13 @@ proc gdb_finish { } { # Exit first, so that the files are no longer in use. gdb_exit =20 - if { [llength $cleanfiles] > 0 } { - eval remote_file target delete $cleanfiles - set cleanfiles {} + if { [llength $cleanfiles_target] > 0 } { + eval remote_file target delete $cleanfiles_target + set cleanfiles_target {} + } + if { [llength $cleanfiles_host] > 0 } { + eval remote_file host delete $cleanfiles_host + set cleanfiles_host {} } =20 # Unblock write access to the banned variables. Dejagnu typically