[PATCH,testsuite] fix several tests for remote-host testing

Nathan Froyd
2009-11-11T20:29:46Z

The patch below fixes a grab-bag of tests for remote host testing. The
symptom in all cases is that files the tests expected to be there didn't
exist on the machine which GDB was running on. The fix is relatively
straightforward; we just remote_download the file and ensure that it's
removed when the test is finished.

Tested with cross to powerpc-linux-gnu on mingw32 host. OK to commit?

-Nathan

* gdb.base/step-line.exp: Copy step-line.inp to the remote host.
* gdb.dwarf2/dw2-basic.exp: Copy file1.txt to the remote host.
* gdb.dwarf2/dw2-compressed.exp: Likewise.
* gdb.dwarf2/dw2-intercu.exp: Likewise.
* gdb.dwarf2/dw2-intermix.exp: Likewise.
* gdb.dwarf2/dw2-producer.exp: Likewise.
* gdb.dwarf2/mac-fileno.exp: Likewise.
* gdb.python/py-prettyprint.exp (run_lang_tests): Copy
py-prettyprint.py to the remote host.
* gdb.python/py-mi.exp: Copy py-mi.py to the remote host.

Index: gdb.base/step-line.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/step-line.exp,v
retrieving revision 1.10
diff -u -u -r1.10 step-line.exp
--- gdb.base/step-line.exp 3 Jan 2009 05:58:03 -0000 1.10
+++ gdb.base/step-line.exp 11 Nov 2009 20:19:46 -0000
@@ -26,6 +26,7 @@

set testfile step-line
set srcfile ${testfile}.c
+set linefile ${testfile}.inp
set binfile ${objdir}/${subdir}/${testfile}

remote_exec build "rm -f ${binfile}"
@@ -44,6 +45,8 @@
return 0
}

+set remote_linefile [remote_download host ${srcdir}/${subdir}/${linefile}]
+
gdb_test "break f1" ".*Breakpoint 2 at .* file step-line.c.*" "break f1"
gdb_test "continue" \
"Continuing.*Breakpoint 2, f1 \\(i=4\\).*dummy \\(1, i\\);" \
@@ -90,4 +93,7 @@
gdb_test "next" \
".*RETURN \\(j\\);.*" \
"next over dummy 10"
+
+remote_file host delete ${remote_linefile}
+
return 0
Index: gdb.dwarf2/dw2-basic.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-basic.exp,v
retrieving revision 1.7
diff -u -u -r1.7 dw2-basic.exp
--- gdb.dwarf2/dw2-basic.exp 3 Jan 2009 05:58:04 -0000 1.7
+++ gdb.dwarf2/dw2-basic.exp 11 Nov 2009 20:19:46 -0000
@@ -27,6 +27,7 @@
}

set testfile "dw2-basic"
+set dwarf_srcfile "file1.txt"
set srcfile ${testfile}.S
set binfile ${objdir}/${subdir}/${testfile}.x

@@ -47,6 +48,10 @@
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}

+set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
+
gdb_test "set listsize 1" ""
gdb_test "list func_cu1" "4\[ \t\]+File 1 Line 4"
gdb_test "ptype func_cu1" "type = int \\(\\)"
+
+remote_file host delete ${remote_dwarf_srcfile}
Index: gdb.dwarf2/dw2-compressed.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-compressed.exp,v
retrieving revision 1.2
diff -u -u -r1.2 dw2-compressed.exp
--- gdb.dwarf2/dw2-compressed.exp 3 Jan 2009 05:58:04 -0000 1.2
+++ gdb.dwarf2/dw2-compressed.exp 11 Nov 2009 20:19:46 -0000
@@ -27,6 +27,7 @@
}

set testfile "dw2-compressed"
+set dwarf_srcfile "file1.txt"
set srcfile ${testfile}.S
set binfile ${objdir}/${subdir}/${testfile}.x

@@ -47,6 +48,10 @@
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}

+set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
+
gdb_test "set listsize 1" ""
gdb_test "list func_cu1" "4\[ \t\]+File 1 Line 4"
gdb_test "ptype func_cu1" "type = int \\(\\)"
+
+remote_file host delete ${remote_dwarf_srcfile}
Index: gdb.dwarf2/dw2-intercu.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp,v
retrieving revision 1.6
diff -u -u -r1.6 dw2-intercu.exp
--- gdb.dwarf2/dw2-intercu.exp 3 Jan 2009 05:58:04 -0000 1.6
+++ gdb.dwarf2/dw2-intercu.exp 11 Nov 2009 20:19:46 -0000
@@ -27,6 +27,7 @@
}

set testfile "dw2-intercu"
+set dwarf_srcfile "file1.txt"
set srcfile ${testfile}.S
set binfile ${objdir}/${subdir}/${testfile}.x

@@ -47,6 +48,10 @@
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}

+set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
+
gdb_test "set listsize 1" ""
gdb_test "list func_cu1" "4\[ \t\]+File 1 Line 4"
gdb_test "ptype func_cu1" "type = int \\(\\)"
+
+remote_file host delete ${remote_dwarf_srcfile}
Index: gdb.dwarf2/dw2-intermix.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-intermix.exp,v
retrieving revision 1.5
diff -u -u -r1.5 dw2-intermix.exp
--- gdb.dwarf2/dw2-intermix.exp 3 Jan 2009 05:58:04 -0000 1.5
+++ gdb.dwarf2/dw2-intermix.exp 11 Nov 2009 20:19:46 -0000
@@ -27,6 +27,7 @@
}

set testfile "dw2-intermix"
+set dwarf_srcfile "file1.txt"
set srcfile ${testfile}.S
set binfile ${objdir}/${subdir}/${testfile}.x

@@ -47,6 +48,10 @@
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}

+set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
+
gdb_test "set listsize 1" ""
gdb_test "list func_cu1" "4\[ \t\]+File 1 Line 4"
gdb_test "ptype func_cu1" "type = int \\(\\)"
+
+remote_file host delete ${remote_dwarf_srcfile}
Index: gdb.dwarf2/dw2-producer.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-producer.exp,v
retrieving revision 1.4
diff -u -u -r1.4 dw2-producer.exp
--- gdb.dwarf2/dw2-producer.exp 3 Jan 2009 05:58:04 -0000 1.4
+++ gdb.dwarf2/dw2-producer.exp 11 Nov 2009 20:19:46 -0000
@@ -25,6 +25,7 @@
}

set testfile "dw2-producer"
+set dwarf_srcfile "file1.txt"
set srcfile ${testfile}.S
set binfile ${objdir}/${subdir}/${testfile}.x

@@ -45,6 +46,10 @@
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}

+set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
+
gdb_test "set listsize 1" ""
gdb_test "list func_cu1" "4\[ \t\]+File 1 Line 4"
gdb_test "ptype func_cu1" "type = int \\(\\)"
+
+remote_file host delete ${remote_dwarf_srcfile}
Index: gdb.dwarf2/mac-fileno.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/mac-fileno.exp,v
retrieving revision 1.5
diff -u -u -r1.5 mac-fileno.exp
--- gdb.dwarf2/mac-fileno.exp 3 Jan 2009 05:58:04 -0000 1.5
+++ gdb.dwarf2/mac-fileno.exp 11 Nov 2009 20:19:46 -0000
@@ -28,6 +28,7 @@
}

set testfile "mac-fileno"
+set dwarf_srcfile "file1.txt"
set srcfile ${testfile}.S
set binfile ${objdir}/${subdir}/${testfile}.x

@@ -48,6 +49,10 @@
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}

+set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
+
gdb_test "set listsize 1" ""
gdb_test "list func_cu1" "4\[ \t\]+File 1 Line 4"
gdb_test "ptype func_cu1" "type = int \\(\\)"
+
+remote_file host delete ${remote_dwarf_srcfile}
Index: gdb.python/py-mi.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.python/py-mi.exp,v
retrieving revision 1.2
diff -u -u -r1.2 py-mi.exp
--- gdb.python/py-mi.exp 15 Sep 2009 18:51:26 -0000 1.2
+++ gdb.python/py-mi.exp 11 Nov 2009 20:19:46 -0000
@@ -43,7 +43,9 @@

mi_runto main

-mi_gdb_test "python execfile ('${srcdir}/${subdir}/${testfile}.py')" ""
+set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+
+mi_gdb_test "python execfile ('${remote_python_file}')" ""

mi_continue_to_line [gdb_get_line_number {MI breakpoint here} ${testfile}.c] \
"step to breakpoint"
@@ -232,3 +234,5 @@
"step to second breakpoint"

mi_varobj_update_with_type_change container int 0 "update after type change"
+
+remote_file host delete ${remote_python_file}
Index: gdb.python/py-prettyprint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.python/py-prettyprint.exp,v
retrieving revision 1.2
diff -u -u -r1.2 py-prettyprint.exp
--- gdb.python/py-prettyprint.exp 21 Sep 2009 09:39:53 -0000 1.2
+++ gdb.python/py-prettyprint.exp 11 Nov 2009 20:19:46 -0000
@@ -72,8 +72,10 @@
gdb_test "b [gdb_get_line_number {break to inspect} ${testfile}.c ]" \
".*Breakpoint.*"
gdb_test "continue" ".*Breakpoint.*"
-
- gdb_test "python execfile ('${srcdir}/${subdir}/${testfile}.py')" ""
+
+ set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+
+ gdb_test "python execfile ('${remote_python_file}')" ""

gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>"
gdb_test "print ssa\[1\]" " = a=< a=<5> b=<$hex>> b=< a=<6> b=<$hex>>"
@@ -103,6 +105,8 @@
gdb_test "print c" " = container $hex \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}"

gdb_test "continue" "Program exited normally\."
+
+ remote_file host delete ${remote_python_file}
}

run_lang_tests "c"