Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] [testsuite] Fix running in-src-dir in the same directory twice
@ 2014-08-28 21:10 Jan Kratochvil
  2014-08-29 12:38 ` Doug Evans
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2014-08-28 21:10 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1599 bytes --]

Hi,

./configure; make; cd gdb; make check; make check
->
Running ./gdb.base/argv0-symlink-dirlink/a2-run.exp ...
Running ./gdb.base/argv0-symlink-dirlink/advance.exp ...
Running ./gdb.base/argv0-symlink-dirlink/argv0-symlink-dirlink/a2-run.exp ...
Running ./gdb.base/argv0-symlink-dirlink/argv0-symlink-dirlink/advance.exp ...
Running ./gdb.base/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/double-prompt-target-event-error.exp ...

particularly I was testing it with:
cp -a testsuite/ testsuite-clean;make -C testsuite/ -k -j1 check;cp -a testsuite/ testsuite-pass1;make -C testsuite/ -k -j1 check;cp -a testsuite/ testsuite-pass2

(The second run still has many FAILs due to deleted source files but that is
a different patch going to be posted.)


Thanks,
Jan

[-- Attachment #2: dirlink.patch --]
[-- Type: text/plain, Size: 1420 bytes --]

gdb/testsuite/
2014-08-28  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix running in-src-dir testsuite in the same directory twice.
	* gdb.base/argv0-symlink.exp: Delete $dirlink.

diff --git a/gdb/testsuite/gdb.base/argv0-symlink.exp b/gdb/testsuite/gdb.base/argv0-symlink.exp
index d849b4c..39aab9c 100644
--- a/gdb/testsuite/gdb.base/argv0-symlink.exp
+++ b/gdb/testsuite/gdb.base/argv0-symlink.exp
@@ -59,6 +59,7 @@ set dirlink "${testfile}-dirlink"
 remote_exec host "rm -f [standard_output_file $dirlink]"
 set status [remote_exec host "ln -sf . [standard_output_file $dirlink]"]
 if {[lindex $status 0] != 0} {
+    remote_exec host "rm -f [standard_output_file $dirlink]"
     unsupported "$test (host does not support symbolic links)"
     return 0
 }
@@ -66,6 +67,7 @@ if {[lindex $status 0] != 0} {
 clean_restart "$dirlink/$filelink"
 
 if ![runto_main] {
+    remote_exec host "rm -f [standard_output_file $dirlink]"
     untested "could not run to main"
     return -1
 }
@@ -79,3 +81,8 @@ if ![is_remote target] {
 }
 gdb_test {print argv[0]} "/$dirlink/$filelink\"" $test
 gdb_test "info inferiors" "/$lastdir/$filelink *" "$test for info inferiors"
+
+# Stale directory symlink would deadlock runtest:
+# Running ./gdb.base/argv0-symlink-dirlink/a2-run.exp ...
+# Running ./gdb.base/argv0-symlink-dirlink/argv0-symlink-dirlink/a2-run.exp ...
+remote_exec host "rm -f [standard_output_file $dirlink]"

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] [testsuite] Fix running in-src-dir in the same directory twice
  2014-08-28 21:10 [patch] [testsuite] Fix running in-src-dir in the same directory twice Jan Kratochvil
@ 2014-08-29 12:38 ` Doug Evans
  2014-08-29 12:49   ` Jan Kratochvil
  2014-08-29 13:13   ` Jan Kratochvil
  0 siblings, 2 replies; 5+ messages in thread
From: Doug Evans @ 2014-08-29 12:38 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

Jan Kratochvil writes:
 > Hi,
 > 
 > ./configure; make; cd gdb; make check; make check
 > ->
 > Running ./gdb.base/argv0-symlink-dirlink/a2-run.exp ...
 > Running ./gdb.base/argv0-symlink-dirlink/advance.exp ...
 > Running ./gdb.base/argv0-symlink-dirlink/argv0-symlink-dirlink/a2-run.exp ...
 > Running ./gdb.base/argv0-symlink-dirlink/argv0-symlink-dirlink/advance.exp ...
 > Running ./gdb.base/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/argv0-symlink-dirlink/double-prompt-target-event-error.exp ...
 > 
 > particularly I was testing it with:
 > cp -a testsuite/ testsuite-clean;make -C testsuite/ -k -j1 check;cp -a testsuite/ testsuite-pass1;make -C testsuite/ -k -j1 check;cp -a testsuite/ testsuite-pass2
 > 
 > (The second run still has many FAILs due to deleted source files but that is
 > a different patch going to be posted.)
 > 
 > 
 > Thanks,
 > Jan
 > gdb/testsuite/
 > 2014-08-28  Jan Kratochvil  <jan.kratochvil@redhat.com>
 > 
 > 	Fix running in-src-dir testsuite in the same directory twice.
 > 	* gdb.base/argv0-symlink.exp: Delete $dirlink.
 > 
 > diff --git a/gdb/testsuite/gdb.base/argv0-symlink.exp b/gdb/testsuite/gdb.base/argv0-symlink.exp
 > index d849b4c..39aab9c 100644
 > --- a/gdb/testsuite/gdb.base/argv0-symlink.exp
 > +++ b/gdb/testsuite/gdb.base/argv0-symlink.exp
 > @@ -59,6 +59,7 @@ set dirlink "${testfile}-dirlink"
 >  remote_exec host "rm -f [standard_output_file $dirlink]"
 >  set status [remote_exec host "ln -sf . [standard_output_file $dirlink]"]
 >  if {[lindex $status 0] != 0} {
 > +    remote_exec host "rm -f [standard_output_file $dirlink]"
 >      unsupported "$test (host does not support symbolic links)"
 >      return 0
 >  }
 > @@ -66,6 +67,7 @@ if {[lindex $status 0] != 0} {
 >  clean_restart "$dirlink/$filelink"
 >  
 >  if ![runto_main] {
 > +    remote_exec host "rm -f [standard_output_file $dirlink]"
 >      untested "could not run to main"
 >      return -1
 >  }
 > @@ -79,3 +81,8 @@ if ![is_remote target] {
 >  }
 >  gdb_test {print argv[0]} "/$dirlink/$filelink\"" $test
 >  gdb_test "info inferiors" "/$lastdir/$filelink *" "$test for info inferiors"
 > +
 > +# Stale directory symlink would deadlock runtest:
 > +# Running ./gdb.base/argv0-symlink-dirlink/a2-run.exp ...
 > +# Running ./gdb.base/argv0-symlink-dirlink/argv0-symlink-dirlink/a2-run.exp ...
 > +remote_exec host "rm -f [standard_output_file $dirlink]"

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?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] [testsuite] Fix running in-src-dir in the same directory twice
  2014-08-29 12:38 ` Doug Evans
@ 2014-08-29 12:49   ` Jan Kratochvil
  2014-08-29 13:13   ` Jan Kratochvil
  1 sibling, 0 replies; 5+ messages in thread
From: Jan Kratochvil @ 2014-08-29 12:49 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

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?

Do you mean start of argv0-symlink.exp?  There was/is already:
	remote_file host delete [standard_output_file $filelink]
	set status [remote_exec host "ln -sf ${testfile} [standard_output_file $filelink]"]

Or do you mean moving this 'remote_file host delete' to the very start of the
testcase - that is just moving it before [build_executable]?

I do not know if there is a possibility to register some cleanup function for
the current testcase.  But also I do not know how the testcase could end by
a different codepath than those I protected in the patch.


Thanks,
Jan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] [testsuite] Fix running in-src-dir in the same directory twice
  2014-08-29 12:38 ` Doug Evans
  2014-08-29 12:49   ` Jan Kratochvil
@ 2014-08-29 13:13   ` Jan Kratochvil
  2014-08-29 21:10     ` [patchv2] " Jan Kratochvil
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2014-08-29 13:13 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

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.

Besides that I think it is primarily a dejagnu/runtest bug but I did not file
it.


Jan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [patchv2] [testsuite] Fix running in-src-dir in the same directory twice
  2014-08-29 13:13   ` Jan Kratochvil
@ 2014-08-29 21:10     ` Jan Kratochvil
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Kratochvil @ 2014-08-29 21:10 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1150 bytes --]

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

[-- Attachment #2: subdir.patch --]
[-- Type: text/plain, Size: 2637 bytes --]

gdb/testsuite/
2014-08-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	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"

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-29 21:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-28 21:10 [patch] [testsuite] Fix running in-src-dir in the same directory twice Jan Kratochvil
2014-08-29 12:38 ` Doug Evans
2014-08-29 12:49   ` Jan Kratochvil
2014-08-29 13:13   ` Jan Kratochvil
2014-08-29 21:10     ` [patchv2] " Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox