From patchwork Fri Aug 29 21:10:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 2596 Received: (qmail 19007 invoked by alias); 29 Aug 2014 21:10:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 18995 invoked by uid 89); 29 Aug 2014 21:10:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 29 Aug 2014 21:10:53 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7TLAntu003058 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 Aug 2014 17:10:50 -0400 Received: from host2.jankratochvil.net (ovpn-113-193.phx2.redhat.com [10.3.113.193]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7TLAjjW006574 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Fri, 29 Aug 2014 17:10:48 -0400 Date: Fri, 29 Aug 2014 23:10:45 +0200 From: Jan Kratochvil To: Doug Evans Cc: gdb-patches@sourceware.org Subject: [patchv2] [testsuite] Fix running in-src-dir in the same directory twice Message-ID: <20140829211045.GA5890@host2.jankratochvil.net> References: <20140828211010.GA4960@host2.jankratochvil.net> <21503.42231.813828.804626@ruffy2.mtv.corp.google.com> <20140829131326.GA19760@host2.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140829131326.GA19760@host2.jankratochvil.net> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes On Fri, 29 Aug 2014 15:13:26 +0200, Jan Kratochvil wrote: > On Thu, 28 Aug 2014 23:53:59 +0200, Doug Evans wrote: > > Tests can prematurely terminate for various unanticipatable reasons. > > Can this be solved by making sure any possibly hazardous left > > over files are cleaned up at start? > > I think it would be best to modify the testcase so that the '. -> symlink' > is made in a special subdirectory so that the *.exp files loop cannot occur > even if the symlink is left there. Done here. Therefore it no longer tries to delete the symlink as it no longer does any harm: $ ls -l testsuite/gdb.base/argv0-symlink.* -rw-r--r-- 1 jkratoch jkratoch 803 Aug 29 21:59 testsuite/gdb.base/argv0-symlink.c -rw-r--r-- 1 jkratoch jkratoch 2839 Aug 29 21:59 testsuite/gdb.base/argv0-symlink.exp testsuite/gdb.base/argv0-symlink.d: total 16 -rwxr-xr-x 1 jkratoch jkratoch 9493 Aug 29 22:45 argv0-symlink* lrwxrwxrwx 1 jkratoch jkratoch 1 Aug 29 22:45 argv0-symlink-dirlink -> ./ lrwxrwxrwx 1 jkratoch jkratoch 13 Aug 29 22:45 argv0-symlink-filelink -> argv0-symlink* -rw-r--r-- 1 jkratoch jkratoch 2824 Aug 29 22:45 argv0-symlink0.o $ _ Jan gdb/testsuite/ 2014-08-29 Jan Kratochvil Fix running in-src-dir in the same directory twice. * gdb.base/argv0-symlink.exp: Move everything into a subdirectory. diff --git a/gdb/testsuite/gdb.base/argv0-symlink.exp b/gdb/testsuite/gdb.base/argv0-symlink.exp index d849b4c..2005e7c 100644 --- a/gdb/testsuite/gdb.base/argv0-symlink.exp +++ b/gdb/testsuite/gdb.base/argv0-symlink.exp @@ -15,21 +15,26 @@ standard_testfile -if { [build_executable ${testfile}.exp ${testfile} ${srcfile}] == -1 } { +set outputbase ${testfile}.d +set outputdir [standard_output_file $outputbase] +remote_exec host "rm -rf $outputdir" +file mkdir $outputdir + +if { [build_executable ${testfile}.exp [file join $outputbase ${testfile}] ${srcfile}] == -1 } { return -1 } set test "kept file symbolic link name" set filelink "${testfile}-filelink" -remote_file host delete [standard_output_file $filelink] -set status [remote_exec host "ln -sf ${testfile} [standard_output_file $filelink]"] +remote_file host delete [file join $outputdir $filelink] +set status [remote_exec host "ln -sf ${testfile} [file join $outputdir $filelink]"] if {[lindex $status 0] != 0} { unsupported "$test (host does not support symbolic links)" return 0 } -clean_restart "$filelink" +clean_restart [file join $outputbase $filelink] if ![runto_main] { untested "could not run to main" @@ -44,7 +49,7 @@ gdb_test {print argv[0]} "/$filelink\"" $test # For a link named /PATH/TO/DIR/LINK, we want to check the output # against "/DIR/LINK", but computed in a way that doesn't make # assumptions about the test directory layout. -set full_filelink [standard_output_file $filelink] +set full_filelink [file join $outputdir $filelink] set lastdir [file tail [file dirname $full_filelink]] gdb_test "info inferiors" "/$lastdir/$filelink *" "$test for info inferiors" @@ -56,14 +61,14 @@ set dirlink "${testfile}-dirlink" # 'ln -sf' does not overwrite symbol link to a directory. # 'remote_file host delete' uses stat (not lstat), therefore it refuses to # delete a directory. -remote_exec host "rm -f [standard_output_file $dirlink]" -set status [remote_exec host "ln -sf . [standard_output_file $dirlink]"] +remote_exec host "rm -f [file join $outputdir $dirlink]" +set status [remote_exec host "ln -sf . [file join $outputdir $dirlink]"] if {[lindex $status 0] != 0} { unsupported "$test (host does not support symbolic links)" return 0 } -clean_restart "$dirlink/$filelink" +clean_restart [file join $outputbase $dirlink $filelink] if ![runto_main] { untested "could not run to main"