+2017-01-26  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * gdb.python/py-bad-printers.exp: Load python file using "source".
+       * gdb.python/py-events.exp: Likewise.
+       * gdb.python/py-evsignal.exp: Likewise.
+       * gdb.python/py-evthreads.exp: Likewise.
+       * gdb.python/py-frame-args.exp: Likewise.
+       * gdb.python/py-framefilter-invalidarg.exp: Likewise.
+       * gdb.python/py-framefilter-mi.exp: Likewise.
+       * gdb.python/py-framefilter.exp: Likewise.
+       * gdb.python/py-mi.exp: Likewise.
+       * gdb.python/py-pp-maint.exp: Likewise.
+       * gdb.python/py-pp-registration.exp: Likewise.
+       * gdb.python/py-prettyprint.exp: Likewise.
+       (run_lang_tests): Likewise.
+       * gdb.python/py-typeprint.exp: Likewise.
+
 2017-01-26  Luis Machado  <lgustavo@codesourcery.com>
 
        * lib/memory.exp: New file.
 
 set remote_python_file [gdb_remote_download host \
                            ${srcdir}/${subdir}/${testfile}.py]
 
-gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
-    "load python file"
+gdb_test_no_output "source ${remote_python_file}" "load python file"
 
 gdb_breakpoint [gdb_get_line_number "break here"]
 gdb_continue_to_breakpoint "break here" ".* break here .*"
 
 
 if { [skip_python_tests] } { continue }
 
-gdb_test_no_output "python exec (open ('${pyfile}').read ())" ""
+gdb_test_no_output "source ${pyfile}" "load python file"
 
 gdb_test "test-objfile-events" "Object file events registered."
 
 
 
 if { [skip_python_tests] } { continue }
 
-gdb_test_no_output "python exec (open ('${pyfile}').read ())" ""
+gdb_test_no_output "source ${pyfile}" "load python file"
 
 gdb_test "test-events" "Event testers registered."
 gdb_test_no_output "set non-stop on"
 
 
 if { [skip_python_tests] } { continue }
 
-gdb_test_no_output "python exec (open ('${pyfile}').read ())" ""
+gdb_test_no_output "source ${pyfile}" "load python file"
 
 gdb_test "test-events" "Event testers registered."
 gdb_test_no_output "set non-stop on"
 
 set remote_python_file [gdb_remote_download host \
                            ${srcdir}/${subdir}/${testfile}.py]
 
-gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
-    "python exec (open ('[file tail ${remote_python_file}]').read ())"
+gdb_test_no_output "source ${remote_python_file}" "load python file"
 
 gdb_breakpoint [gdb_get_line_number "break-here"]
 gdb_continue_to_breakpoint "break-here" ".* break-here .*"
 
 # Load global frame-filters
 set remote_python_file [gdb_remote_download host \
                            ${srcdir}/${subdir}/${testfile}.py]
-gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
-    "load python file"
+gdb_test_no_output "source ${remote_python_file}" "load python file"
 
 gdb_test "bt" " in niam \\(argc=<error reading variable: dwarf expression stack underflow>, argv=0x\[0-9a-f\]+\\) at py-framefilter-invalidarg.c:\[0-9\]+" "bt full with filters"
 
 
 set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
 
-mi_gdb_test "python exec (open ('${remote_python_file}').read ())" ".*\\^done." \
-    "Load python file"
+mi_gdb_test "source ${remote_python_file}" ".*\\^done." "load python file"
 
 # Multiple blocks test
 mi_continue_to_line [gdb_get_line_number {Inner test breakpoint} ${srcfile}] \
 
 # Load global frame-filters
 set remote_python_file [gdb_remote_download host \
                            ${srcdir}/${subdir}/${testfile}.py]
-gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
-    "load python file"
+gdb_test_no_output "source ${remote_python_file}" "load python file"
 
 gdb_breakpoint [gdb_get_line_number "Backtrace end breakpoint"]
 gdb_breakpoint [gdb_get_line_number "Inner test breakpoint"]
 # Load global frame-filters
 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 "source ${remote_python_file}" \
     "load python file for no debuginfo tests"
 
 # Disable Reverse
 
 
 set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
 
-mi_gdb_test "python exec (open ('${remote_python_file}').read ())" ""
+mi_gdb_test "source ${remote_python_file}" "load python file"
 
 mi_continue_to_line [gdb_get_line_number {MI breakpoint here} ${srcfile}] \
   "step to breakpoint"
 
 
 set python_file ${srcdir}/${subdir}/${testfile}.py
 
-gdb_test_no_output "python exec (open ('${python_file}').read ())" ""
+gdb_test_no_output "source ${python_file}" "load python file"
 
 gdb_test "info pretty-printer" \
     {.*function_lookup_test.*pp-test.*struct ss.*}
 
        return 0
     }
 
-    gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
-       "read file"
+    gdb_test_no_output "source ${remote_python_file}" "read file"
 
     gdb_test_no_output "py progspace = gdb.current_progspace()"
     gdb_test_no_output "py my_pretty_printer1 = build_pretty_printer1()"
 
     set remote_python_file [gdb_remote_download host \
                                ${srcdir}/${subdir}/${testfile}.py]
 
-    gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
-       "python exec (open ('[file tail ${remote_python_file}]').read ())"
+    gdb_test_no_output "source ${remote_python_file}" "load 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>>"
 set remote_python_file [gdb_remote_download host \
                            ${srcdir}/${subdir}/${testfile}.py]
 
-gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
-    "python exec (open ('[file tail ${remote_python_file}]').read ())"
+gdb_test_no_output "source ${remote_python_file}" "load python file"
 
 gdb_breakpoint [gdb_get_line_number "eval-break"]
 gdb_continue_to_breakpoint "eval-break" ".* eval-break .*"
 
 set remote_python_file [gdb_remote_download host \
                            ${srcdir}/${subdir}/${testfile}.py]
 
-gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
-    "python exec (open ('[file tail ${remote_python_file}]').read ())"
+gdb_test_no_output "source ${remote_python_file}" "load python file"
 
 cp_test_ptype_class s "basic test" "class" "templ<string>" {
     { field public "T x;" }