Don't remove files copied to host
authorYao Qi <yao@codesourcery.com>
Mon, 29 Sep 2014 12:47:30 +0000 (20:47 +0800)
committerYao Qi <yao@codesourcery.com>
Mon, 20 Oct 2014 05:34:28 +0000 (13:34 +0800)
Nowadays, if we do in-tree build and run tests sequentially, some source
files are removed, due to the following pattern:

set pi_txt [gdb_remote_download host ${srcdir}/${subdir}/pi.txt]

remote_exec host "rm -f $pi_txt"

If testing is run sequentially, file ${srcdir}/${subdir}/pi.txt is
copied to ${objdir}/${subdir}/pi.txt.  However, ${objdir} is ${srcdir}
in the in-tree build/test, so the file is coped to itself, as a nop.
As a result, the file in source is removed at the end of test.

This patch fixes this problem by not removing files copied to host in
each test.  This patch also addresses the question we've had that why
don't we keep files copied to host because they are needed to reproduce
certain fails.

gdb/testsuite:

2014-10-20  Yao Qi  <yao@codesourcery.com>

* gdb.base/checkpoint.exp: Don't remove file copied on host.
* gdb.base/step-line.exp: Likewise.
* gdb.dwarf2/dw2-anonymous-func.exp: Likewise.
* gdb.dwarf2/dw2-basic.exp: Likewise.
* gdb.dwarf2/dw2-compressed.exp: Likewise.
* gdb.dwarf2/dw2-filename.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-frame-args.exp: Likewise.
* gdb.python/py-framefilter.exp: Likewise.
* gdb.python/py-mi.exp: Likewise.
* gdb.python/py-objfile-script.exp: Likewise
* gdb.python/py-pp-integral.exp: Likewise.
* gdb.python/py-pp-re-notag.exp: Likewise.
* gdb.python/py-prettyprint.exp: Likewise.
* gdb.python/py-section-script.exp: Likewise.
* gdb.python/py-typeprint.exp: Likewise.
* gdb.python/py-xmethods.exp: Likewise.
* gdb.stabs/weird.exp: Likewise.
* gdb.xml/tdesc-regs.exp: Likewise.

23 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/checkpoint.exp
gdb/testsuite/gdb.base/step-line.exp
gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.exp
gdb/testsuite/gdb.dwarf2/dw2-basic.exp
gdb/testsuite/gdb.dwarf2/dw2-compressed.exp
gdb/testsuite/gdb.dwarf2/dw2-filename.exp
gdb/testsuite/gdb.dwarf2/dw2-intercu.exp
gdb/testsuite/gdb.dwarf2/dw2-intermix.exp
gdb/testsuite/gdb.dwarf2/dw2-producer.exp
gdb/testsuite/gdb.dwarf2/mac-fileno.exp
gdb/testsuite/gdb.python/py-frame-args.exp
gdb/testsuite/gdb.python/py-framefilter.exp
gdb/testsuite/gdb.python/py-mi.exp
gdb/testsuite/gdb.python/py-objfile-script.exp
gdb/testsuite/gdb.python/py-pp-integral.exp
gdb/testsuite/gdb.python/py-pp-re-notag.exp
gdb/testsuite/gdb.python/py-prettyprint.exp
gdb/testsuite/gdb.python/py-section-script.exp
gdb/testsuite/gdb.python/py-typeprint.exp
gdb/testsuite/gdb.python/py-xmethods.exp
gdb/testsuite/gdb.stabs/weird.exp
gdb/testsuite/gdb.xml/tdesc-regs.exp

index 75c497a82fbe1efcec6a1f3991b1671e9b07e953..a0bb480776ccc090c7813c15d339b72c6c10ad55 100644 (file)
@@ -1,3 +1,28 @@
+2014-10-20  Yao Qi  <yao@codesourcery.com>
+
+       * gdb.base/checkpoint.exp: Don't remove file copied on host.
+       * gdb.base/step-line.exp: Likewise.
+       * gdb.dwarf2/dw2-anonymous-func.exp: Likewise.
+       * gdb.dwarf2/dw2-basic.exp: Likewise.
+       * gdb.dwarf2/dw2-compressed.exp: Likewise.
+       * gdb.dwarf2/dw2-filename.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-frame-args.exp: Likewise.
+       * gdb.python/py-framefilter.exp: Likewise.
+       * gdb.python/py-mi.exp: Likewise.
+       * gdb.python/py-objfile-script.exp: Likewise
+       * gdb.python/py-pp-integral.exp: Likewise.
+       * gdb.python/py-pp-re-notag.exp: Likewise.
+       * gdb.python/py-prettyprint.exp: Likewise.
+       * gdb.python/py-section-script.exp: Likewise.
+       * gdb.python/py-typeprint.exp: Likewise.
+       * gdb.python/py-xmethods.exp: Likewise.
+       * gdb.stabs/weird.exp: Likewise.
+       * gdb.xml/tdesc-regs.exp: Likewise.
+
 2014-10-18  Kwok Cheung Yeung  <kcy@codesourcery.com>
 
        * gdb.dwarf2/dw2-dir-file-name.exp (addr_len): New.
index b5ed1d3bfa7c7f665f20543b5d4940523c24c785..2de24398aa3b558b253afe4f36596b75c262fb5f 100644 (file)
@@ -371,5 +371,3 @@ verbose "Timeout now $timeout sec."
 #
 # Finished: cleanup
 #
-
-remote_exec host "rm -f $pi_txt"
index 94799f80b92009cbf2f2d853e9aed7c5f59bb187..7f515652c0d6843a5f2addd13ed919763aa26545 100644 (file)
@@ -82,6 +82,4 @@ gdb_test "next" \
          ".*RETURN \\(j\\);.*" \
         "next over dummy 10"
 
-remote_file host delete ${remote_linefile}
-
 return 0
index 029104b4c1fccdcf24bb17de5443e78e57c92695..817c98891039a9c2ec10cfa8f8637e9cd7463bbb 100644 (file)
@@ -29,11 +29,8 @@ if {[prepare_for_testing_full $testfile.exp \
     return -1
 }
 
-set remote_dwarf_srcfile [gdb_remote_download host \
-                             ${srcdir}/${subdir}/${dwarf_srcfile}]
+gdb_remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}
 
 # Force the debugger to create the file1.txt symtab, to make sure that
 # the debugger does not crash doing so.
 gdb_test "list file1.txt:1" "File 1 Line 1.*File 1 Line 8" "list file1.txt"
-
-remote_file host delete ${remote_dwarf_srcfile}
index 7823eaa45d90a429c91b57318f554b8a47c94df7..c5d5b0a5d60c1c96cc3490705e448ecb01d4a4c9 100644 (file)
@@ -29,11 +29,8 @@ if {[prepare_for_testing_full $testfile.exp \
     return -1
 }
 
-set remote_dwarf_srcfile [gdb_remote_download host \
-                             ${srcdir}/${subdir}/${dwarf_srcfile}]
+gdb_remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}
 
 gdb_test_no_output "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 76009d2ef767a001db265fc713b42b8ad7f1d1ce..7a783b75f8d7cd323cbeab010e2c818e398518d0 100644 (file)
@@ -31,11 +31,8 @@ if {[prepare_for_testing_full $testfile.exp \
     return -1
 }
 
-set remote_dwarf_srcfile [gdb_remote_download host \
-                             ${srcdir}/${subdir}/${dwarf_srcfile}]
+gdb_remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}
 
 gdb_test_no_output "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 c9ead97975ca00539351a6498c0534e680727a25..95b4aeb892788a7bb08ab3fd6ebc7c5f75374d43 100644 (file)
@@ -28,8 +28,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {nodebug
     return -1
 }
 
-set remote_dwarf_srcfile [gdb_remote_download host \
-                             ${srcdir}/${subdir}/${dwarf_srcfile}]
+gdb_remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}
 
 clean_restart ${testfile}
 
@@ -42,5 +41,3 @@ gdb_test "interpreter-exec mi -file-list-exec-source-files" \
 
 # And `info sources' should return the fullname incl. the directories.
 gdb_test "info sources" {[/\\]file1\.txt}
-
-remote_file host delete ${remote_dwarf_srcfile}
index 4a23c96efc47719f8ac9573823566700baf8dea2..ce1c15f13d5b494ad558e08d9c091edab9f09e02 100644 (file)
@@ -42,5 +42,3 @@ gdb_test_no_output "set listsize 1"
 gdb_test "list func_cu1" "4\[ \t\]+File 1 Line 4"
 
 gdb_test "ptype func_cu1" "type = int2 \\(\\)"
-
-remote_file host delete ${remote_dwarf_srcfile}
index 2f95572d8b8335be49ca49bde4f41db1d9ee04a4..1d5d2372aeb5ab0bea58fe859973964f17efa67e 100644 (file)
@@ -29,11 +29,9 @@ if {[prepare_for_testing_full $testfile.exp \
     return -1
 }
 
-set remote_dwarf_srcfile [gdb_remote_download host \
-                             ${srcdir}/${subdir}/${dwarf_srcfile}]
+gdb_remote_download host \
+    ${srcdir}/${subdir}/${dwarf_srcfile}
 
 gdb_test_no_output "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 6846b173667841308d21bfeb0af61cf2d5145b1b..6d786fe1bc0dabbfbd73fbcb333b048980b9cf1d 100644 (file)
@@ -27,11 +27,8 @@ if {[prepare_for_testing_full $testfile.exp \
     return -1
 }
 
-set remote_dwarf_srcfile [gdb_remote_download host \
-                             ${srcdir}/${subdir}/${dwarf_srcfile}]
+gdb_remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}
 
 gdb_test_no_output "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 e7362111214378faf3919a0131bbc500374457de..7711cb38bc6af705e4ba1238e86d8e16bca21a05 100644 (file)
@@ -30,11 +30,8 @@ if {[prepare_for_testing_full $testfile.exp \
     return -1
 }
 
-set remote_dwarf_srcfile [gdb_remote_download host \
-                             ${srcdir}/${subdir}/${dwarf_srcfile}]
+gdb_remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}
 
 gdb_test_no_output "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 4c50be8effcb403f1b69aa16232d4fb5c60f4896..de4d159cec922cb9c2efd26b1070404062e3a878 100644 (file)
@@ -68,5 +68,3 @@ gdb_test_no_output "set print frame-arguments all"
 gdb_test "frame" \
     ".*foo \\(x=42, ss={a = {m = 1}, b = {m = 2}}\\).*" \
     "frame raw,all"
-
-remote_file host delete ${remote_python_file}
index 948ae943e8e88a09d656d7255f063bda6a00a9c7..5d1411572da1ff930f7ca2674b0cecb3dd12c876 100644 (file)
@@ -188,8 +188,6 @@ gdb_test_multiple "bt 1" $test {
     }
 }
 
-remote_file host delete ${remote_python_file}
-
 # Test with no debuginfo
 
 # We cannot use prepare_for_testing as we have to set the safe-patch
index 595917518ece0f8b718a97dfffa5fb6f5dab8183..ca02bf73b7951643ff3f262c69d329db4e73b3ad 100644 (file)
@@ -356,5 +356,3 @@ mi_list_varobj_children fake.private {
 
 mi_gdb_test "-var-set-visualizer fake.private gdb.default_visualizer" \
     "\\^done" "Install visualizer on a cplus_fake_child"
-
-remote_file host delete ${remote_python_file}
index 55f505fe9db889201f4d95ab27065bc2de4bf0fb..298bc3e42ea566404182694a40be14ebb5204245 100644 (file)
@@ -53,5 +53,3 @@ gdb_test "b [gdb_get_line_number {break to inspect} ${testfile}.c ]" \
 gdb_test "continue" ".*Breakpoint.*"
 
 gdb_test "print ss" " = a=<1> b=<2>"
-
-remote_file host delete ${remote_python_file}
index 8149bdeb2b3f0d07069dbab9b86b0172b5b76326..ac4403d9be5b06101a857dd4ba5e5b0f9b311727 100644 (file)
@@ -35,5 +35,3 @@ gdb_test_no_output "source ${remote_python_file}" \
 gdb_test "print *t" " = Thu Nov 14 02:22:23 2013 \\(1384395743\\)"
 
 gdb_test "print /r *t" "= 1384395743"
-
-remote_file host delete ${remote_python_file}
index 8149bdeb2b3f0d07069dbab9b86b0172b5b76326..ac4403d9be5b06101a857dd4ba5e5b0f9b311727 100644 (file)
@@ -35,5 +35,3 @@ gdb_test_no_output "source ${remote_python_file}" \
 gdb_test "print *t" " = Thu Nov 14 02:22:23 2013 \\(1384395743\\)"
 
 gdb_test "print /r *t" "= 1384395743"
-
-remote_file host delete ${remote_python_file}
index 10963892504b302e87110a196d72f8cf797e1e66..ae866f04c7a6eedb5db6f4785f2bac97839d8e47 100644 (file)
@@ -108,8 +108,6 @@ proc run_lang_tests {exefile lang} {
        "print nstype on one line"
 
     gdb_continue_to_end
-
-    remote_file host delete ${remote_python_file}
 }
 
 run_lang_tests "${binfile}" "c"
@@ -155,5 +153,3 @@ gdb_test_no_output "python enable_lookup_function ()"
 
 gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>" \
     "print ss enabled #2"
-
-remote_file host delete ${remote_python_file}
index 4f465cc6c21481474d2e2b4408aebd0a786f7462..5c868d798a4b9526c18e4c1c51974373c2b72e65 100644 (file)
@@ -72,5 +72,3 @@ gdb_test "b [gdb_get_line_number {break to inspect} ${testfile}.c ]" \
 gdb_test "continue" ".*Breakpoint.*"
 
 gdb_test "print ss" " = a=<1> b=<2>"
-
-remote_file host delete ${remote_python_file}
index 1de80bd764042e87d866c167e330a191e62d206c..ee02091277992f579242e27186307db631ddfe2e 100644 (file)
@@ -51,5 +51,3 @@ gdb_test_no_output "enable type-printer string"
 gdb_test "whatis bs" "string" "whatis with enabled printer"
 
 gdb_test "whatis s" "templ<string>"
-
-remote_file host delete ${remote_python_file}
index 8824127f51923d56210a1df41a2331075b505592..093b4bc2cf2b971f2b9cad91804c05fb9938fb89 100644 (file)
@@ -149,5 +149,3 @@ gdb_test_no_output "disable xmethod progspace E_methods;method_int" \
   "disable xmethod progspace E_methods;method_int"
 gdb_test "info xmethod progspace E_methods;method_int" ".* \\\[disabled\\\]" \
   "info xmethod xmethods E_methods;method_int"
-
-remote_file host delete ${xmethods_script}
index 5746770de6e9ef48d688dd1f86fa4aaa0df72814..b5efc686d075872a33395cecba6d04b241557223 100644 (file)
@@ -325,6 +325,4 @@ gdb_expect 60 {
 
 do_tests
 
-remote_file host delete ${binfile}
-
 return 0
index 35c5c5ac53af4930f0be53c4a07441e76d4be586..1db5155462d424346c183dc3ecd7dfd8f7d5061c 100644 (file)
@@ -171,7 +171,3 @@ gdb_test "ptype \$bitfields" \
 load_description "core-only.xml" ""
 # The extra register from the previous description should be gone.
 gdb_test "ptype \$extrareg" "type = void"
-
-foreach src ${core-regs} {
-    remote_file host delete $remote_filename($src)
-}