+2013-08-22  Tom Tromey  <tromey@redhat.com>
+
+       * gdb.python/py-error.exp: Use gdb_remote_download.
+       * gdb.python/py-mi.exp: Use gdb_remote_download.
+       * gdb.python/py-objfile-script.exp: Use standard_output_file.
+       * gdb.python/py-prettyprint.exp: Use gdb_remote_download.
+       (run_lang_tests): Likewise.
+       * gdb.python/py-section-script.c: Use SCRIPT_FILE rather than
+       filename.
+       * gdb.python/py-section-script.exp: Set SCRIPT_FILE when
+       compiling.  Use gdb_remote_download.  Update some tests.
+       * gdb.python/py-strfns.exp (test_strfns_core_file): Use
+       standard_output_file.
+       * gdb.python/py-typeprint.exp: Use gdb_remote_download.
+       * gdb.python/py-frame-args.exp: Use gdb_remote_download.
+       * gdb.python/py-framefilter-mi.exp: Use gdb_remote_download.
+       * gdb.python/py-framefilter.exp: Use gdb_remote_download,
+       standard_output_file.
+
 2013-08-22  Tom Tromey  <tromey@redhat.com>
 
        * lib/cell.exp (skip_cell_tests): Use standard_temp_file.
 
     return 0
 }
 
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+set remote_python_file [gdb_remote_download host \
+                           ${srcdir}/${subdir}/${testfile}.py]
 
 # argc=LookupError: unknown encoding: IBM1047
 gdb_test "source $remote_python_file" "Traceback.*ClassName.*\r\nLookupError: unknown encoding: $charset" $test2
 
     return -1
 }
 
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+set remote_python_file [gdb_remote_download host \
+                           ${srcdir}/${subdir}/${testfile}.py]
 
-gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
+gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
+    "python exec (open ('[file tail ${remote_python_file}]').read ())"
 
 gdb_breakpoint [gdb_get_line_number "break-here"]
 gdb_continue_to_breakpoint "break-here" ".* break-here .*"
 
 
 mi_runto main
 
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${pyfile}]
+set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
 
 mi_gdb_test "python execfile ('${remote_python_file}')" ".*\\^done." \
     "Load python file"
 
 set remote_obj_python_file \
     [remote_download \
         host ${srcdir}/${subdir}/${testfile}-gdb.py.in \
-        ${subdir}/${testfile}-gdb.py]
+        [standard_output_file ${testfile}-gdb.py]]
 
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \
     "Set python print-stack to full"
 
 # Load global frame-filters
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+set remote_python_file [gdb_remote_download host \
+                           ${srcdir}/${subdir}/${testfile}.py]
 gdb_test_no_output "python execfile ('${remote_python_file}')" \
     "Load python file"
 
 set remote_obj_python_file \
     [remote_download \
         host ${srcdir}/${subdir}/${testfile}-gdb.py.in \
-        ${subdir}/${testfile}-gdb.py]
+        [standard_output_file ${testfile}-gdb.py]]
 
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \
     "set python print-stack full for no debuginfo tests"
 
 # Load global frame-filters
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+set remote_python_file [gdb_remote_download host \
+                           ${srcdir}/${subdir}/${testfile}.py]
 gdb_test_no_output "python execfile ('${remote_python_file}')" \
     "Load python file for no debuginfo tests"
 
 
 
 mi_runto main
 
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${pyfile}]
+set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
 
 mi_gdb_test "python exec (open ('${remote_python_file}').read ())" ""
 
 
 # Make the -gdb.py script available to gdb, it is automagically loaded by gdb.
 # Care is taken to put it in the same directory as the binary so that
 # gdb will find it.
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}-gdb.py.in ${subdir}/${testfile}-gdb.py]
+set remote_python_file [remote_download host \
+                           ${srcdir}/${subdir}/${testfile}-gdb.py.in \
+                           [standard_output_file ${testfile}-gdb.py]]
 
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_test_no_output "set auto-load safe-path ${remote_python_file}" "set auto-load safe-path"
 
        ".*Breakpoint.*"
     gdb_test "continue" ".*Breakpoint.*"
 
-    set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+    set remote_python_file [gdb_remote_download host \
+                               ${srcdir}/${subdir}/${testfile}.py]
 
-    gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
+    gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
+       "python exec (open ('[file tail ${remote_python_file}]').read ())"
     
     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>>"
     return
 }
 
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+set remote_python_file [gdb_remote_download host \
+                           ${srcdir}/${subdir}/${testfile}.py]
 
-gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
+gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
+    "python exec (open ('[file tail ${remote_python_file}]').read ())"
 
 gdb_breakpoint [gdb_get_line_number "eval-break"]
 gdb_continue_to_breakpoint "eval-break" ".* eval-break .*"
 
 .popsection \n\
 ");
 
-DEFINE_GDB_SCRIPT ("py-section-script.py")
+DEFINE_GDB_SCRIPT (SCRIPT_FILE)
 
 struct ss
 {
 
 
 standard_testfile
 
-if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
+# Make this available to gdb before the program starts, it is
+# automagically loaded by gdb.
+set remote_python_file [gdb_remote_download host \
+                           ${srcdir}/${subdir}/${testfile}.py]
+
+set quoted_name "\"$remote_python_file\""
+
+if {[build_executable $testfile.exp $testfile $srcfile \
+        [list debug additional_flags=-DSCRIPT_FILE=$quoted_name]] == -1} {
     return -1
 }
 
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-# Make this available to gdb before the program starts, it is
-# automagically loaded by gdb.
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
-
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_test_no_output "set auto-load safe-path ${remote_python_file}" "set auto-load safe-path"
 gdb_load ${binfile}
 
 # Verify gdb loaded the script.
-gdb_test "info auto-load python-scripts" "Yes.*${testfile}.py.*full name: .*/${testfile}.py.*"
+gdb_test "info auto-load python-scripts" "Yes.*${testfile}.py.*"
 # Again, with a regexp this time.
-gdb_test "info auto-load python-scripts ${testfile}" "Yes.*${testfile}.py.*full name: .*/${testfile}.py.*"
+gdb_test "info auto-load python-scripts ${testfile}" "Yes.*${testfile}.py.*"
 # Again, with a regexp that matches no scripts.
 gdb_test "info auto-load python-scripts no-script-matches-this" \
   "No auto-load scripts matching no-script-matches-this."
 
 # Verify use on a core file.
 
 proc test_strfns_core_file { } {
-    global objdir subdir gdb_prompt testfile
+    global gdb_prompt testfile
 
-    set filename "${objdir}/${subdir}/py-strfns.core"
+    set filename [standard_output_file py-strfns.core]
 
     if {![gdb_gcore_cmd "$filename" "save a corefile"]} {
        # No use proceeding from here.
 
 
 if { [skip_python_tests] } { continue }
 
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+set remote_python_file [gdb_remote_download host \
+                           ${srcdir}/${subdir}/${testfile}.py]
 
-gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
+gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
+    "python exec (open ('[file tail ${remote_python_file}]').read ())"
 
 cp_test_ptype_class s "basic test" "class" "templ<string>" {
     { field public "T x;" }