diff --git a/gdb/testsuite/gdb.base/step-line.exp b/gdb/testsuite/gdb.base/step-line.exp
index 94799f8..1de77b3 100644
--- a/gdb/testsuite/gdb.base/step-line.exp
+++ b/gdb/testsuite/gdb.base/step-line.exp
@@ -82,6 +82,8 @@ gdb_test "next" \
          ".*RETURN \\(j\\);.*" \
 	 "next over dummy 10"
 
-remote_file host delete ${remote_linefile}
+if [is_remote host] {
+    remote_file host delete ${remote_linefile}
+}
 
 return 0
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.exp
index 029104b..3ee795d 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.exp
@@ -36,4 +36,6 @@ set remote_dwarf_srcfile [gdb_remote_download host \
 # 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}
+if [is_remote host] {
+    remote_file host delete ${remote_dwarf_srcfile}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-basic.exp b/gdb/testsuite/gdb.dwarf2/dw2-basic.exp
index 7823eaa..16a0b6a 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-basic.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-basic.exp
@@ -36,4 +36,6 @@ 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}
+if [is_remote host] {
+    remote_file host delete ${remote_dwarf_srcfile}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-compressed.exp b/gdb/testsuite/gdb.dwarf2/dw2-compressed.exp
index 76009d2..9160316 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-compressed.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-compressed.exp
@@ -38,4 +38,6 @@ 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}
+if [is_remote host] {
+    remote_file host delete ${remote_dwarf_srcfile}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-filename.exp b/gdb/testsuite/gdb.dwarf2/dw2-filename.exp
index c9ead97..8eed1e4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-filename.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-filename.exp
@@ -43,4 +43,6 @@ 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}
+if [is_remote host] {
+    remote_file host delete ${remote_dwarf_srcfile}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp b/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp
index 4a23c96..8367928 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp
@@ -43,4 +43,6 @@ 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}
+if [is_remote host] {
+    remote_file host delete ${remote_dwarf_srcfile}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-intermix.exp b/gdb/testsuite/gdb.dwarf2/dw2-intermix.exp
index 2f95572..dc91a0e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-intermix.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-intermix.exp
@@ -36,4 +36,6 @@ 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}
+if [is_remote host] {
+    remote_file host delete ${remote_dwarf_srcfile}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-producer.exp b/gdb/testsuite/gdb.dwarf2/dw2-producer.exp
index 6846b17..65ecb9e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-producer.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-producer.exp
@@ -34,4 +34,6 @@ 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}
+if [is_remote host] {
+    remote_file host delete ${remote_dwarf_srcfile}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/mac-fileno.exp b/gdb/testsuite/gdb.dwarf2/mac-fileno.exp
index e736211..6f57ce5 100644
--- a/gdb/testsuite/gdb.dwarf2/mac-fileno.exp
+++ b/gdb/testsuite/gdb.dwarf2/mac-fileno.exp
@@ -37,4 +37,6 @@ 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}
+if [is_remote host] {
+    remote_file host delete ${remote_dwarf_srcfile}
+}
diff --git a/gdb/testsuite/gdb.python/py-frame-args.exp b/gdb/testsuite/gdb.python/py-frame-args.exp
index 4c50be8..dcaf711 100644
--- a/gdb/testsuite/gdb.python/py-frame-args.exp
+++ b/gdb/testsuite/gdb.python/py-frame-args.exp
@@ -69,4 +69,6 @@ gdb_test "frame" \
     ".*foo \\(x=42, ss={a = {m = 1}, b = {m = 2}}\\).*" \
     "frame raw,all"
 
-remote_file host delete ${remote_python_file}
+if [is_remote host] {
+    remote_file host delete ${remote_python_file}
+}
diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp
index 948ae94..33c8742 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter.exp
@@ -188,7 +188,9 @@ gdb_test_multiple "bt 1" $test {
     }
 }
 
-remote_file host delete ${remote_python_file}
+if [is_remote host] {
+    remote_file host delete ${remote_python_file}
+}
 
 # Test with no debuginfo
 
diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp
index 5959175..1c7a86b 100644
--- a/gdb/testsuite/gdb.python/py-mi.exp
+++ b/gdb/testsuite/gdb.python/py-mi.exp
@@ -357,4 +357,6 @@ 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}
+if [is_remote host] {
+    remote_file host delete ${remote_python_file}
+}
diff --git a/gdb/testsuite/gdb.python/py-pp-integral.exp b/gdb/testsuite/gdb.python/py-pp-integral.exp
index 8149bde..189f79c 100644
--- a/gdb/testsuite/gdb.python/py-pp-integral.exp
+++ b/gdb/testsuite/gdb.python/py-pp-integral.exp
@@ -36,4 +36,6 @@ 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}
+if [is_remote host] {
+    remote_file host delete ${remote_python_file}
+}
diff --git a/gdb/testsuite/gdb.python/py-pp-re-notag.exp b/gdb/testsuite/gdb.python/py-pp-re-notag.exp
index 8149bde..189f79c 100644
--- a/gdb/testsuite/gdb.python/py-pp-re-notag.exp
+++ b/gdb/testsuite/gdb.python/py-pp-re-notag.exp
@@ -36,4 +36,6 @@ 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}
+if [is_remote host] {
+    remote_file host delete ${remote_python_file}
+}
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index 491b52d..0a41864 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -106,7 +106,9 @@ proc run_lang_tests {exefile lang} {
 
     gdb_continue_to_end
 
-    remote_file host delete ${remote_python_file}
+    if [is_remote host] {
+	remote_file host delete ${remote_python_file}
+    }
 }
 
 run_lang_tests "${binfile}" "c"
@@ -153,4 +155,6 @@ 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}
+if [is_remote host] {
+    remote_file host delete ${remote_python_file}
+}
diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp
index 4f465cc..32e43f4 100644
--- a/gdb/testsuite/gdb.python/py-section-script.exp
+++ b/gdb/testsuite/gdb.python/py-section-script.exp
@@ -73,4 +73,6 @@ gdb_test "continue" ".*Breakpoint.*"
 
 gdb_test "print ss" " = a=<1> b=<2>"
 
-remote_file host delete ${remote_python_file}
+if [is_remote host] {
+    remote_file host delete ${remote_python_file}
+}
diff --git a/gdb/testsuite/gdb.python/py-typeprint.exp b/gdb/testsuite/gdb.python/py-typeprint.exp
index 1de80bd..e2f68d7 100644
--- a/gdb/testsuite/gdb.python/py-typeprint.exp
+++ b/gdb/testsuite/gdb.python/py-typeprint.exp
@@ -52,4 +52,6 @@ gdb_test "whatis bs" "string" "whatis with enabled printer"
 
 gdb_test "whatis s" "templ<string>"
 
-remote_file host delete ${remote_python_file}
+if [is_remote host] {
+    remote_file host delete ${remote_python_file}
+}
diff --git a/gdb/testsuite/gdb.python/py-xmethods.exp b/gdb/testsuite/gdb.python/py-xmethods.exp
index 8824127..5501528 100644
--- a/gdb/testsuite/gdb.python/py-xmethods.exp
+++ b/gdb/testsuite/gdb.python/py-xmethods.exp
@@ -150,4 +150,6 @@ gdb_test_no_output "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}
+if [is_remote host] {
+    remote_file host delete ${xmethods_script}
+}
