This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit/testsuite] Add remote-host support to gdb.xml tests


Tsk, I even wrote these tests...

They use "open" and "puts" to write to a local file, and then tell GDB
to read the file.  This does not work well for remote host testing;
even if the directory is shared between the local system and the
remote host (the only scenario we've found where remote testing is at
all reliable), the remote host won't notice when we delete and rewrite
the file.

This patchchanges the affected tests to use remote_upload and
remote_download as other tests do.

-- 
Daniel Jacobowitz
CodeSourcery

2010-02-16  Daniel Jacobowitz  <dan@codesourcery.com>

	gdb/testsuite/
	* gdb.xml/tdesc-arch.exp, gdb.xml/tdesc-regs.exp: Rewrite file
	creation to support remote host testing.

diff -urp gdb-merged-orig/gdb/testsuite/gdb.xml/tdesc-arch.exp gdb-merged/gdb/testsuite/gdb.xml/tdesc-arch.exp
--- gdb-merged-orig/gdb/testsuite/gdb.xml/tdesc-arch.exp	2010-02-10 14:45:54.000000000 -0800
+++ gdb-merged/gdb/testsuite/gdb.xml/tdesc-arch.exp	2010-02-15 07:41:44.000000000 -0800
@@ -58,13 +58,15 @@ if { "$arch1" == "" || "$arch2" == "" ||
 
 proc set_arch { arch which } {
     global gdb_prompt
+    global subdir
 
-    set fd [open "tdesc-arch.xml" w]
+    set fd [open "$subdir/tdesc-arch.xml" w]
     puts $fd \
 	"<target>
 	    <architecture>$arch</architecture>
 	 </target>"
     close $fd
+    remote_download host "${subdir}/tdesc-arch.xml" "tdesc-arch.xml"
 
     # Anchor the test output, so that error messages are detected.
     set cmd "set tdesc filename tdesc-arch.xml"
@@ -84,19 +86,21 @@ proc set_arch { arch which } {
 	"The target architecture is set automatically \\(currently $arch\\)" \
 	"$cmd ($which architecture)"
 
-    file delete "tdesc-arch.xml"
+    file delete "${subdir}/tdesc-arch.xml"
+    remote_file host delete "tdesc-arch.xml"
 }
 
 set_arch $arch1 first
 set_arch $arch2 second
 
 # Check an invalid architecture setting.
-set fd [open "tdesc-arch.xml" w]
+set fd [open "${subdir}/tdesc-arch.xml" w]
 puts $fd \
     "<target>
        <architecture>invalid</architecture>
      </target>"
 close $fd
+remote_download host "$subdir/tdesc-arch.xml" "tdesc-arch.xml"
 
 set cmd "set tdesc filename tdesc-arch.xml"
 gdb_test $cmd \
@@ -108,4 +112,5 @@ gdb_test $cmd \
     "The target architecture is set automatically \\(currently $default_arch\\)" \
     "$cmd (invalid architecture)"
 
-file delete "tdesc-arch.xml"
+file delete "${subdir}/tdesc-arch.xml"
+remote_file host delete "tdesc-arch.xml"
diff -urp gdb-merged-orig/gdb/testsuite/gdb.xml/tdesc-regs.exp gdb-merged/gdb/testsuite/gdb.xml/tdesc-regs.exp
--- gdb-merged-orig/gdb/testsuite/gdb.xml/tdesc-regs.exp	2010-02-10 14:45:54.000000000 -0800
+++ gdb-merged/gdb/testsuite/gdb.xml/tdesc-regs.exp	2010-02-15 07:41:48.000000000 -0800
@@ -80,8 +80,7 @@ gdb_test "set tdesc file $srcdir/$subdir
 # Copy the core registers into the objdir if necessary, so that they
 # will be found by <xi:include>.
 foreach src ${core-regs} {
-    file delete "$src"
-    file copy "$srcdir/../features/$regdir$src" "$src"
+    set file [remote_download host "$srcdir/../features/$regdir$src" "$src"]
 }
 
 # Similarly, we need to copy files under test into the objdir.
@@ -91,9 +90,9 @@ proc load_description { file errmsg } {
     global gdb_prompt
     global core-regs
 
-    file delete "regs.xml"
+    file delete "$subdir/regs.xml"
     set ifd [open "$srcdir/$subdir/$file" r]
-    set ofd [open "regs.xml" w]
+    set ofd [open "$subdir/regs.xml" w]
     while {[gets $ifd line] >= 0} {
 	if {[regexp {<xi:include href="core-regs.xml"/>} $line]} {
 	    foreach src ${core-regs} {
@@ -105,16 +104,19 @@ proc load_description { file errmsg } {
     }
     close $ifd
     close $ofd
+    remote_download host "$subdir/regs.xml" "regs.xml"
+    file delete "$subdir/regs.xml"
 
     # Anchor the test output, so that error messages are detected.
     set cmd "set tdesc filename regs.xml"
-    set msg "set tdesc filename $file"
+    set msg "set tdesc filename regs.xml - from $file"
     set cmd_regex [string_to_regexp $cmd]
     gdb_test_multiple $cmd $msg {
 	-re "^$cmd_regex\r\n$errmsg$gdb_prompt $" {
 	    pass $msg
 	}
     }
+    remote_file host delete "regs.xml"
 }
 
 load_description "extra-regs.xml" ""
@@ -130,6 +132,5 @@ load_description "core-only.xml" ""
 gdb_test "ptype \$extrareg" "type = void"
 
 foreach src ${core-regs} {
-    file delete "$src"
+    remote_file host delete "$src"
 }
-file delete "regs.xml"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]