Patchwork [testsuite] Fixes for gdb.python tests on remote Windows host

login
register
mail settings
Submitter Sandra Loosemore
Date Aug. 12, 2019, 10:20 p.m.
Message ID <59beb385-aec5-13b8-6095-3c7eb18f94be@codesourcery.com>
Download mbox | patch
Permalink /patch/34065/
State New
Headers show

Comments

Sandra Loosemore - Aug. 12, 2019, 10:20 p.m.
The attached patch fixes a bunch of FAILs and ERRORs I've seen in 
gdb.python tests running on remote Windows host.  As noted in the commit 
message, the fixes are mostly obvious and repetitive;  e.g., remember to 
copy the .py script to the remote host before trying to source it. 
Since this is a pretty big patch, though, I wasn't sure the whole thing 
qualifies as "obvious", and wanted to give folks a chance to object 
before I check it in.  So I propose to push it to trunk in a week if I 
don't hear any objection or review (or promise to review) meanwhile.

-Sandra
Doug Evans via gdb-patches - Aug. 13, 2019, 1:34 a.m.
Do the mingw checks in this patch also need to consider cygwin? E.g.:
This GDB was configured as "x86_64-pc-cygwin".

On Mon, Aug 12, 2019 at 5:20 PM Sandra Loosemore
<sandra@codesourcery.com> wrote:
>
> The attached patch fixes a bunch of FAILs and ERRORs I've seen in
> gdb.python tests running on remote Windows host.  As noted in the commit
> message, the fixes are mostly obvious and repetitive;  e.g., remember to
> copy the .py script to the remote host before trying to source it.
> Since this is a pretty big patch, though, I wasn't sure the whole thing
> qualifies as "obvious", and wanted to give folks a chance to object
> before I check it in.  So I propose to push it to trunk in a week if I
> don't hear any objection or review (or promise to review) meanwhile.
>
> -Sandra
Simon Marchi - Aug. 13, 2019, 1:46 a.m.
On 2019-08-12 6:20 p.m., Sandra Loosemore wrote:
> The attached patch fixes a bunch of FAILs and ERRORs I've seen in 
> gdb.python tests running on remote Windows host.  As noted in the commit 
> message, the fixes are mostly obvious and repetitive;  e.g., remember to 
> copy the .py script to the remote host before trying to source it. 
> Since this is a pretty big patch, though, I wasn't sure the whole thing 
> qualifies as "obvious", and wanted to give folks a chance to object 
> before I check it in.  So I propose to push it to trunk in a week if I 
> don't hear any objection or review (or promise to review) meanwhile.
> 
> -Sandra

Hi Sandra,

Windows and remote host testing are two aspects that are really not tested upstream,
so thanks a lot for doing this.  I ran the gdb.python testsuite locally on Linux and
didn't see any change in the results, which is good.

Just two nits on my side:

> diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp
> index c4a6974..0ab1519 100644
> --- a/gdb/testsuite/gdb.python/py-section-script.exp
> +++ b/gdb/testsuite/gdb.python/py-section-script.exp
> @@ -77,22 +77,35 @@ gdb_exit
>  gdb_start
>  gdb_reinitialize_dir $srcdir/$subdir
>
> -gdb_test_no_output "set auto-load safe-path ${remote_python_file}:${binfile}" \
> +# Get the name of the binfile on the host; on a remote host this means
> +# stripping off any directory prefix.
> +if [is_remote host] {
> +  set remote_binfile [file tail ${binfile}]
> +} else {
> +  set remote_binfile ${binfile}
> +}

4 spaces indentation

> +
> +if [ishost *-*-mingw*] {
> +    set remote_pathsep ";"
> +} else {
> +    set remote_pathsep ":"
> +}
> +gdb_test_no_output "set auto-load safe-path ${remote_python_file}${remote_pathsep}${remote_binfile}" \
>      "set auto-load safe-path"
>  gdb_load ${binfile}
>
>  # Verify gdb loaded each script and they appear once in the list.
>  set test_name "verify scripts loaded"
>  gdb_test_multiple "info auto-load python-scripts" "$test_name" {
> +    -re "Yes.*${testfile}.py.*Yes.*inlined-script.*$gdb_prompt $" {
> +	pass "$test_name"
> +    }
>      -re "${testfile}.py.*${testfile}.py.*$gdb_prompt $" {
>  	fail "$test_name"
>      }
>      -re "inlined-script.*inlined-script.*$gdb_prompt $" {
>  	fail "$test_name"
>      }
> -    -re "Yes.*${testfile}.py.*Yes.*inlined-script.*$gdb_prompt $" {
> -	pass "$test_name"
> -    }

Is this last change necessary?

Simon
Sandra Loosemore - Aug. 13, 2019, 2:18 a.m.
On 8/12/19 7:34 PM, Christian Biesinger wrote:
> Do the mingw checks in this patch also need to consider cygwin? E.g.:
> This GDB was configured as "x86_64-pc-cygwin".

I believe they are completely separate targets.  I don't know much about 
cygwin, but I assume that Python built for cygwin library is linked with 
the cygwin C library and understands cygwin's fake symbolic links, while 
Python built for the mingw C library certainly does not.  Similarly, 
using ";" instead of ":" in PATH-like things is a Windows thing, while 
I'm pretty sure cygwin emulates the POSIX syntax.

-Sandra
Sandra Loosemore - Aug. 13, 2019, 2:31 a.m.
On 8/12/19 7:46 PM, Simon Marchi wrote:
> On 2019-08-12 6:20 p.m., Sandra Loosemore wrote:
>> The attached patch fixes a bunch of FAILs and ERRORs I've seen in
>> gdb.python tests running on remote Windows host.  As noted in the commit
>> message, the fixes are mostly obvious and repetitive;  e.g., remember to
>> copy the .py script to the remote host before trying to source it.
>> Since this is a pretty big patch, though, I wasn't sure the whole thing
>> qualifies as "obvious", and wanted to give folks a chance to object
>> before I check it in.  So I propose to push it to trunk in a week if I
>> don't hear any objection or review (or promise to review) meanwhile.
>>
>> -Sandra
> 
> Hi Sandra,
> 
> Windows and remote host testing are two aspects that are really not tested upstream,
> so thanks a lot for doing this.  I ran the gdb.python testsuite locally on Linux and
> didn't see any change in the results, which is good.
> 
> Just two nits on my side:
> 
>> diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp
>> index c4a6974..0ab1519 100644
>> --- a/gdb/testsuite/gdb.python/py-section-script.exp
>> +++ b/gdb/testsuite/gdb.python/py-section-script.exp
>> @@ -77,22 +77,35 @@ gdb_exit
>>   gdb_start
>>   gdb_reinitialize_dir $srcdir/$subdir
>>
>> -gdb_test_no_output "set auto-load safe-path ${remote_python_file}:${binfile}" \
>> +# Get the name of the binfile on the host; on a remote host this means
>> +# stripping off any directory prefix.
>> +if [is_remote host] {
>> +  set remote_binfile [file tail ${binfile}]
>> +} else {
>> +  set remote_binfile ${binfile}
>> +}
> 
> 4 spaces indentation

Ooops!  I need to do something to make Emacs go into tcl mode 
automatically for .exp files.

> 
>> +
>> +if [ishost *-*-mingw*] {
>> +    set remote_pathsep ";"
>> +} else {
>> +    set remote_pathsep ":"
>> +}
>> +gdb_test_no_output "set auto-load safe-path ${remote_python_file}${remote_pathsep}${remote_binfile}" \
>>       "set auto-load safe-path"
>>   gdb_load ${binfile}
>>
>>   # Verify gdb loaded each script and they appear once in the list.
>>   set test_name "verify scripts loaded"
>>   gdb_test_multiple "info auto-load python-scripts" "$test_name" {
>> +    -re "Yes.*${testfile}.py.*Yes.*inlined-script.*$gdb_prompt $" {
>> +	pass "$test_name"
>> +    }
>>       -re "${testfile}.py.*${testfile}.py.*$gdb_prompt $" {
>>   	fail "$test_name"
>>       }
>>       -re "inlined-script.*inlined-script.*$gdb_prompt $" {
>>   	fail "$test_name"
>>       }
>> -    -re "Yes.*${testfile}.py.*Yes.*inlined-script.*$gdb_prompt $" {
>> -	pass "$test_name"
>> -    }
> 
> Is this last change necessary?

Yes.  On Windows host, the output I'm seeing for this test that it's 
trying to match is:

(gdb) info auto-load python-scripts
Loaded  Script 


Yes     py-section-script.py 


         full name: \\long\windows\path\to\py-section-script.py
Yes     gdb.inlined-script 


(gdb)

This matches the first "fail" pattern as well as the "pass" pattern, so 
the ordering is important.  From the comment on this test, it's clear 
this output is intended to be a "pass", so that one should go first.

-Sandra
Simon Marchi - Aug. 13, 2019, 2:39 a.m.
On 2019-08-12 10:31 p.m., Sandra Loosemore wrote:
> Yes.  On Windows host, the output I'm seeing for this test that it's 
> trying to match is:
> 
> (gdb) info auto-load python-scripts
> Loaded  Script 
> 
> 
> Yes     py-section-script.py 
> 
> 
>          full name: \\long\windows\path\to\py-section-script.py
> Yes     gdb.inlined-script 
> 
> 
> (gdb)
> 
> This matches the first "fail" pattern as well as the "pass" pattern, so 
> the ordering is important.  From the comment on this test, it's clear 
> this output is intended to be a "pass", so that one should go first.
> 
> -Sandra

Ok, that clears it up, thanks.

Simon
Simon Marchi - Aug. 13, 2019, 2:54 a.m.
On 2019-08-12 10:18 p.m., Sandra Loosemore wrote:
> I believe they are completely separate targets.  I don't know much about 
> cygwin, but I assume that Python built for cygwin library is linked with 
> the cygwin C library and understands cygwin's fake symbolic links, while 
> Python built for the mingw C library certainly does not.  Similarly, 
> using ";" instead of ":" in PATH-like things is a Windows thing, while 
> I'm pretty sure cygwin emulates the POSIX syntax.

Indeed, testing on cygwin would be a whole other task.

I forgot to mention, the patch LGTM, so if Christian is fine with this response too, then please push.

Simon
Doug Evans via gdb-patches - Aug. 13, 2019, 3:01 a.m.
On Mon, Aug 12, 2019 at 9:54 PM Simon Marchi <simark@simark.ca> wrote:
>
> On 2019-08-12 10:18 p.m., Sandra Loosemore wrote:
> > I believe they are completely separate targets.  I don't know much about
> > cygwin, but I assume that Python built for cygwin library is linked with
> > the cygwin C library and understands cygwin's fake symbolic links, while
> > Python built for the mingw C library certainly does not.  Similarly,
> > using ";" instead of ":" in PATH-like things is a Windows thing, while
> > I'm pretty sure cygwin emulates the POSIX syntax.
>
> Indeed, testing on cygwin would be a whole other task.
>
> I forgot to mention, the patch LGTM, so if Christian is fine with this response too, then please push.

Yeah, that sounds good.

Christian
Sandra Loosemore - Aug. 13, 2019, 4:31 p.m.
On 8/12/19 8:54 PM, Simon Marchi wrote:
> On 2019-08-12 10:18 p.m., Sandra Loosemore wrote:
>> I believe they are completely separate targets.  I don't know much about
>> cygwin, but I assume that Python built for cygwin library is linked with
>> the cygwin C library and understands cygwin's fake symbolic links, while
>> Python built for the mingw C library certainly does not.  Similarly,
>> using ";" instead of ":" in PATH-like things is a Windows thing, while
>> I'm pretty sure cygwin emulates the POSIX syntax.
> 
> Indeed, testing on cygwin would be a whole other task.
> 
> I forgot to mention, the patch LGTM, so if Christian is fine with this response too, then please push.

Thanks for the speedy review!  I fixed the indentation problem you noted 
before pushing the patch.

BTW, these are not the only issues I noticed in running the Python tests 
on Windows host.  There's another set involving the "explore" command 
and the python interactive help which fail with timeouts because the 
expected output is getting buffered.  At this point I'm not sure whether 
this is a problem with our test environment (we use cygwin ssh, which 
native Windows doesn't recognize as a tty), or some misconfiguration in 
the version of Windows python we are using.  I've got a local patch to 
temporarily disable those tests to speed up testing, but I don't think 
that's a good fix for mainline.  It would be better to figure out how to 
force Python to unbuffer the output.

-Sandra

Patch

commit a71336a227b8e4f78c24073168bdb45c57d156ef
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Mon Aug 12 14:39:07 2019 -0700

    Fixes for gdb.python tests on remote Windows host.
    
    This patch fixes several test ERRORs and FAILs seen from running
    gdb.python tests on a remote Windows host.  The problems fixed
    generally fall into these categories:
    - Failure to copy the .py script to the host.
    - Confusion between build and host pathnames.
    - Assuming pathnames printed on the host include "/" as a directory
      separator.
    - Tests that need to be conditionally disabled due to missing features
      on the host, etc.
    
    2019-08-12  Sandra Loosemore  <sandra@codesourcery.com>
    
    	gdb/testsuite/
    	* gdb.python/py-completion.exp: Download the .py file to the host
    	and use its host pathname.  Conditionalize tests that use
    	tab completion and manipulate files on the build machine.
    	* gdb.python/py-events.exp: Download the .py file to the host
    	and use its host pathname.
    	* gdb.python/py-evsignal.exp: Likewise.
    	* gdb.python/py-evthreads.exp: Likewise.
    	* gdb.python/py-framefilter-invalidarg.exp: Match Windows
    	pathname syntax.
    	* gdb.python/py-framefilter.exp: Download the .py file to the right
    	place on the host.  Match Windows pathname syntax.
    	* gdb.python/py-mi-var-info-path-expression.exp: Download the
    	.py file to the host and use its host pathname.
    	* gdb.python/py-objfile-script.exp: Match Windows pathname syntax.
    	* gdb.python/py-objfile.exp: Expect a host pathname, not a
    	build pathname.  Skip symlink test on Windows host.  Add missing
    	newline at end of file.
    	* gdb.python/py-pp-maint.exp: Download the .py file to the host
    	and use its host pathname.
    	* gdb.python/py-pp-registration.exp: Match Windows pathname syntax.
    	* gdb.python/py-section-script.exp: Use host location of binfile
    	on safe-path.  Use correct path separator on Windows host.
    	Reorder alternatives in gdb_test_multiple to prevent matching
    	the wrong alternative on success.
    	* gdb.python/py-symtab.exp: Match Windows pathname syntax.

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index fb19b9d..6dd180c 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,31 @@ 
+2019-08-12  Sandra Loosemore  <sandra@codesourcery.com>
+
+	* gdb.python/py-completion.exp: Download the .py file to the host
+	and use its host pathname.  Conditionalize tests that use
+	tab completion and manipulate files on the build machine.
+	* gdb.python/py-events.exp: Download the .py file to the host
+	and use its host pathname.
+	* gdb.python/py-evsignal.exp: Likewise.
+	* gdb.python/py-evthreads.exp: Likewise.
+	* gdb.python/py-framefilter-invalidarg.exp: Match Windows
+	pathname syntax.
+	* gdb.python/py-framefilter.exp: Download the .py file to the right
+	place on the host.  Match Windows pathname syntax.
+	* gdb.python/py-mi-var-info-path-expression.exp: Download the
+	.py file to the host and use its host pathname.
+	* gdb.python/py-objfile-script.exp: Match Windows pathname syntax.
+	* gdb.python/py-objfile.exp: Expect a host pathname, not a
+	build pathname.  Skip symlink test on Windows host.  Add missing
+	newline at end of file.
+	* gdb.python/py-pp-maint.exp: Download the .py file to the host
+	and use its host pathname.
+	* gdb.python/py-pp-registration.exp: Match Windows pathname syntax.
+	* gdb.python/py-section-script.exp: Use host location of binfile
+	on safe-path.  Use correct path separator on Windows host.
+	Reorder alternatives in gdb_test_multiple to prevent matching
+	the wrong alternative on success.
+	* gdb.python/py-symtab.exp: Match Windows pathname syntax.
+
 2019-08-12  Patrick Palka  <patrick@parcs.ath.cx>
 
 	* gdb.gdb/selftest.exp (test_with_self): Update test to now
diff --git a/gdb/testsuite/gdb.python/py-completion.exp b/gdb/testsuite/gdb.python/py-completion.exp
index 3c54360..1b1398c 100644
--- a/gdb/testsuite/gdb.python/py-completion.exp
+++ b/gdb/testsuite/gdb.python/py-completion.exp
@@ -17,65 +17,69 @@  set testfile "py-completion"
 
 load_lib gdb-python.exp
 
+set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
+set discard 0
 gdb_exit
 gdb_start
 
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-gdb_test_no_output "source ${srcdir}/${subdir}/${testfile}.py" \
-    "load python file"
-
-# Create a temporary directory
-set testdir "[standard_output_file "py-completion-testdir"]/"
-set testdir_regex [string_to_regexp $testdir]
-set testdir_complete [standard_output_file "py-completion-test"]
-file mkdir $testdir
-
-# This one should always pass.
-send_gdb "completefileinit ${testdir_complete}\t"
-gdb_test_multiple "" "completefileinit completion" {
-    -re "^completefileinit ${testdir_regex}$" {
-        pass "completefileinit completion"
+# Tab completion tests require readline support, and this set of tests
+# doesn't work on a remote host either.
+if { [readline_is_used] && ![is_remote host] } {
+    gdb_test_no_output "source ${pyfile}" "load python file"
+
+    # Create a temporary directory
+    set testdir "[standard_output_file "py-completion-testdir"]/"
+    set testdir_regex [string_to_regexp $testdir]
+    set testdir_complete [standard_output_file "py-completion-test"]
+    file mkdir $testdir
+
+    # This one should always pass.
+    send_gdb "completefileinit ${testdir_complete}\t"
+    gdb_test_multiple "" "completefileinit completion" {
+	-re "^completefileinit ${testdir_regex}$" {
+	    pass "completefileinit completion"
+	}
     }
-}
 
-# Just discarding whatever we typed.
-set discard 0
-gdb_test " " ".*" "discard #[incr discard]"
+    # Just discarding whatever we typed.
+    gdb_test " " ".*" "discard #[incr discard]"
 
-# This is the problematic one.
-send_gdb "completefilemethod ${testdir_complete}\t"
-gdb_test_multiple "" "completefilemethod completion" {
-    -re "^completefilemethod ${testdir_regex} $" {
-        fail "completefilemethod completion (completed filename as wrong command arg)"
-    }
-    -re "^completefilemethod ${testdir_regex}$" {
-        pass "completefilemethod completion"
+    # This is the problematic one.
+    send_gdb "completefilemethod ${testdir_complete}\t"
+    gdb_test_multiple "" "completefilemethod completion" {
+	-re "^completefilemethod ${testdir_regex} $" {
+	    fail "completefilemethod completion (completed filename as wrong command arg)"
+	}
+	-re "^completefilemethod ${testdir_regex}$" {
+	    pass "completefilemethod completion"
+	}
     }
-}
 
-# Discarding again
-gdb_test " " ".*" "discard #[incr discard]"
+    # Discarding again
+    gdb_test " " ".*" "discard #[incr discard]"
 
-# Another problematic
-set completion_regex "[string_to_regexp [standard_output_file "py-completion-t"]]"
-send_gdb "completefilecommandcond [standard_output_file "py-completion-t\t"]"
-gdb_test_multiple "" "completefilecommandcond completion" {
-    -re "^completefilecommandcond ${testdir}$" {
-	fail "completefilecommandcond completion (completed filename instead of command)"
-    }
-    -re "^completefilecommandcond ${completion_regex}\007$" {
-	pass "completefilecommandcond completion"
+    # Another problematic
+    set completion_regex "[string_to_regexp [standard_output_file "py-completion-t"]]"
+    send_gdb "completefilecommandcond [standard_output_file "py-completion-t\t"]"
+    gdb_test_multiple "" "completefilecommandcond completion" {
+	-re "^completefilecommandcond ${testdir}$" {
+	    fail "completefilecommandcond completion (completed filename instead of command)"
+	}
+	-re "^completefilecommandcond ${completion_regex}\007$" {
+	    pass "completefilecommandcond completion"
+	}
     }
+
 }
 
 # Start gdb over again to clear out current state.  This can interfere
 # with the expected output of the below tests in a buggy gdb.
 gdb_exit
 gdb_start
-gdb_test_no_output "source ${srcdir}/${subdir}/${testfile}.py" \
-    "load python file again"
+gdb_test_no_output "source ${pyfile}" "load python file again"
 
 gdb_test_sequence "complete completel" \
     "list all completions of 'complete completel'" {
diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp
index 817101c..771d1de 100644
--- a/gdb/testsuite/gdb.python/py-events.exp
+++ b/gdb/testsuite/gdb.python/py-events.exp
@@ -26,7 +26,6 @@  set lib_opts  debug
 
 standard_testfile
 set exec_opts [list debug shlib=$lib_sl]
-set pyfile ${srcdir}/${subdir}/${testfile}.py
 
 if [get_compiler_info] {
     return -1
@@ -43,6 +42,7 @@  clean_restart ${testfile}
 
 if { [skip_python_tests] } { continue }
 
+set pyfile [gdb_remote_download host ${srcdir}/${subdir}/py-events.py]
 gdb_test_no_output "source ${pyfile}" "load python file"
 
 gdb_test "test-objfile-events" "Object file events registered."
diff --git a/gdb/testsuite/gdb.python/py-evsignal.exp b/gdb/testsuite/gdb.python/py-evsignal.exp
index 9e4dcf3..c79ddcf 100644
--- a/gdb/testsuite/gdb.python/py-evsignal.exp
+++ b/gdb/testsuite/gdb.python/py-evsignal.exp
@@ -23,7 +23,6 @@  if {[target_info gdb_protocol] == "remote"
 load_lib gdb-python.exp
 
 standard_testfile py-evthreads.c
-set pyfile ${srcdir}/${subdir}/py-events.py
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     return -1
@@ -32,6 +31,7 @@  clean_restart $testfile
 
 if { [skip_python_tests] } { continue }
 
+set pyfile [gdb_remote_download host ${srcdir}/${subdir}/py-events.py]
 gdb_test_no_output "source ${pyfile}" "load python file"
 
 gdb_test "test-events" "Event testers registered."
diff --git a/gdb/testsuite/gdb.python/py-evthreads.exp b/gdb/testsuite/gdb.python/py-evthreads.exp
index 5cd91dc..d688c5b 100644
--- a/gdb/testsuite/gdb.python/py-evthreads.exp
+++ b/gdb/testsuite/gdb.python/py-evthreads.exp
@@ -21,7 +21,6 @@  if { ![support_displaced_stepping] } {
 load_lib gdb-python.exp
 
 standard_testfile
-set pyfile ${srcdir}/${subdir}/py-events.py
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     return -1
@@ -34,6 +33,7 @@  save_vars { GDBFLAGS } {
 
 if { [skip_python_tests] } { continue }
 
+set pyfile [gdb_remote_download host ${srcdir}/${subdir}/py-events.py]
 gdb_test_no_output "source ${pyfile}" "load python file"
 
 gdb_test "test-events" "Event testers registered."
diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
index 2213bcf..99b9f57 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
@@ -48,7 +48,7 @@  gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \
     "set auto-load safe-path"
 gdb_load ${binfile}
 # Verify gdb loaded the script.
-gdb_test "info auto-load python-scripts" "Yes.*/${testfile}-gdb.py.*" \
+gdb_test "info auto-load python-scripts" "Yes.*${testfile}-gdb.py.*" \
     "Test auto-load had loaded python scripts"
 
 if ![runto_main] then {
diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp
index e3aed24..336c885 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter.exp
@@ -41,16 +41,15 @@  gdb_test "info frame-filter" \
 # Care is taken to put it in the same directory as the binary so that
 # gdb will find it.
 set remote_obj_python_file \
-    [remote_download \
-	 host ${srcdir}/${subdir}/${testfile}-gdb.py.in \
-	 [standard_output_file ${testfile}-gdb.py]]
+    [gdb_remote_download host ${srcdir}/${subdir}/${testfile}-gdb.py.in \
+	 ${testfile}-gdb.py]
 
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \
     "set auto-load safe-path"
 gdb_load ${binfile}
 # Verify gdb loaded the script.
-gdb_test "info auto-load python-scripts" "Yes.*/${testfile}-gdb.py.*" \
+gdb_test "info auto-load python-scripts" "Yes.*${testfile}-gdb.py.*" \
     "Test auto-load had loaded python scripts"
 
 if ![runto_main] then {
@@ -302,9 +301,8 @@  if { [skip_python_tests] } { continue }
 # Care is taken to put it in the same directory as the binary so that
 # gdb will find it.
 set remote_obj_python_file \
-    [remote_download \
-	 host ${srcdir}/${subdir}/${testfile}-gdb.py.in \
-	 [standard_output_file ${testfile}-gdb.py]]
+    [gdb_remote_download host ${srcdir}/${subdir}/${testfile}-gdb.py.in \
+	 ${testfile}-gdb.py]
 
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \
@@ -312,7 +310,7 @@  gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \
 gdb_load ${binfile}
 
 # Verify gdb loaded the script.
-gdb_test "info auto-load python-scripts" "Yes.*/${testfile}-gdb.py.*" \
+gdb_test "info auto-load python-scripts" "Yes.*${testfile}-gdb.py.*" \
     "Set autoload path for no debug info tests"
 if ![runto_main] then {
     perror "couldn't run to breakpoint"
diff --git a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
index 02f0c93..0bec17e 100644
--- a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
+++ b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
@@ -35,7 +35,8 @@  if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" }
 # Skip all tests if Python scripting is not enabled.
 if { [mi_skip_python_tests] } { continue }
 
-mi_gdb_test "source ${srcdir}/${subdir}/${testfile}.py" \
+set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
+mi_gdb_test "source ${pyfile}" \
   ".*\\^done" \
   "load python file"
 
diff --git a/gdb/testsuite/gdb.python/py-objfile-script.exp b/gdb/testsuite/gdb.python/py-objfile-script.exp
index 14744c3..b318acc 100644
--- a/gdb/testsuite/gdb.python/py-objfile-script.exp
+++ b/gdb/testsuite/gdb.python/py-objfile-script.exp
@@ -40,7 +40,7 @@  gdb_test_no_output "set auto-load safe-path ${remote_python_file}" "set auto-loa
 gdb_load ${binfile}
 
 # Verify gdb loaded the script.
-gdb_test "info auto-load python-scripts" "Yes.*/${testfile}-gdb.py.*"
+gdb_test "info auto-load python-scripts" "Yes.*${testfile}-gdb.py.*"
 
 if ![runto_main] {
     perror "couldn't run to main"
diff --git a/gdb/testsuite/gdb.python/py-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp
index cfe092e..154c2e5 100644
--- a/gdb/testsuite/gdb.python/py-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-objfile.exp
@@ -46,7 +46,7 @@  gdb_test "python print (objfile.username)" "${testfile}" \
   "Get objfile user name"
 
 gdb_test "python print (objfile)" \
-    "<gdb.Objfile filename=[string_to_regexp ${binfile}]>"
+    "<gdb.Objfile filename=.*${testfile}.*>"
 
 gdb_test_no_output "python dir(objfile)"
 
@@ -158,17 +158,20 @@  if { [get_python_valueof "sep_objfile.build_id" "None"] != "None" } {
 
 # An objfile that was a symlink to a differently named file is still
 # findable with its original name.
-set symlink_binary [standard_output_file "symlink-binary"]
-remote_exec host "rm -f ${symlink_binary}"
-remote_exec host "ln -sf ${testfile} ${symlink_binary}"
-if [remote_file host exists "${symlink_binary}"] {
-    clean_restart "${symlink_binary}"
-    gdb_test "python print (gdb.lookup_objfile (\"${symlink_binary}\").filename)" \
-	"${testfile}" "gdb.lookup_objfile of symlinked binary"
+# On Windows we don't have proper symlinks, so skip this.
+if ![ishost *-*-mingw*] {
+    set symlink_binary [standard_output_file "symlink-binary"]
+    remote_exec host "rm -f ${symlink_binary}"
+    remote_exec host "ln -sf ${testfile} ${symlink_binary}"
+    if [remote_file host exists "${symlink_binary}"] {
+	clean_restart "${symlink_binary}"
+	gdb_test "python print (gdb.lookup_objfile (\"${symlink_binary}\").filename)" \
+	    "${testfile}" "gdb.lookup_objfile of symlinked binary"
+    }
 }
 
 # Test printing an Objfile object that is no longer valid.
 gdb_py_test_silent_cmd "python objfile = gdb.objfiles()\[0\]" \
     "get first objfile" 1
 gdb_file_cmd ${binfile}
-gdb_test "python print(objfile)" "<gdb.Objfile \\\(invalid\\\)>"
\ No newline at end of file
+gdb_test "python print(objfile)" "<gdb.Objfile \\\(invalid\\\)>"
diff --git a/gdb/testsuite/gdb.python/py-pp-maint.exp b/gdb/testsuite/gdb.python/py-pp-maint.exp
index 4c65719..b592cba 100644
--- a/gdb/testsuite/gdb.python/py-pp-maint.exp
+++ b/gdb/testsuite/gdb.python/py-pp-maint.exp
@@ -41,7 +41,7 @@  gdb_test "b [gdb_get_line_number {break to inspect} ${testfile}.c ]" \
     ".*Breakpoint.*"
 gdb_test "continue" ".*Breakpoint.*"
 
-set python_file ${srcdir}/${subdir}/${testfile}.py
+set python_file [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
 
 gdb_test_no_output "source ${python_file}" "load python file"
 
diff --git a/gdb/testsuite/gdb.python/py-pp-registration.exp b/gdb/testsuite/gdb.python/py-pp-registration.exp
index 01fc39e..fa9458f 100644
--- a/gdb/testsuite/gdb.python/py-pp-registration.exp
+++ b/gdb/testsuite/gdb.python/py-pp-registration.exp
@@ -91,7 +91,7 @@  with_test_prefix "verbose on" {
     gdb_test "py gdb.printing.register_pretty_printer(gdb, lookup_function_lookup_test)" \
 	"Registering global lookup_function_lookup_test pretty-printer ..."
     gdb_test "py gdb.printing.register_pretty_printer(progspace, my_pretty_printer1)" \
-	"Registering pp-test pretty-printer for .*/py-pp-registration ..."
+	"Registering pp-test pretty-printer for .*py-pp-registration ..."
 
     test_printers "s1"
 }
diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp
index c4a6974..0ab1519 100644
--- a/gdb/testsuite/gdb.python/py-section-script.exp
+++ b/gdb/testsuite/gdb.python/py-section-script.exp
@@ -77,22 +77,35 @@  gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-gdb_test_no_output "set auto-load safe-path ${remote_python_file}:${binfile}" \
+# Get the name of the binfile on the host; on a remote host this means
+# stripping off any directory prefix.
+if [is_remote host] {
+  set remote_binfile [file tail ${binfile}]
+} else {
+  set remote_binfile ${binfile}
+}
+
+if [ishost *-*-mingw*] {
+    set remote_pathsep ";"
+} else {
+    set remote_pathsep ":"
+}
+gdb_test_no_output "set auto-load safe-path ${remote_python_file}${remote_pathsep}${remote_binfile}" \
     "set auto-load safe-path"
 gdb_load ${binfile}
 
 # Verify gdb loaded each script and they appear once in the list.
 set test_name "verify scripts loaded"
 gdb_test_multiple "info auto-load python-scripts" "$test_name" {
+    -re "Yes.*${testfile}.py.*Yes.*inlined-script.*$gdb_prompt $" {
+	pass "$test_name"
+    }
     -re "${testfile}.py.*${testfile}.py.*$gdb_prompt $" {
 	fail "$test_name"
     }
     -re "inlined-script.*inlined-script.*$gdb_prompt $" {
 	fail "$test_name"
     }
-    -re "Yes.*${testfile}.py.*Yes.*inlined-script.*$gdb_prompt $" {
-	pass "$test_name"
-    }
 }
 
 # Again, with a regexp this time.
diff --git a/gdb/testsuite/gdb.python/py-symtab.exp b/gdb/testsuite/gdb.python/py-symtab.exp
index 4a6a2ab..04bff8d 100644
--- a/gdb/testsuite/gdb.python/py-symtab.exp
+++ b/gdb/testsuite/gdb.python/py-symtab.exp
@@ -66,8 +66,8 @@  gdb_test "python print (sal.is_valid())" "True" "test sal.is_valid"
 
 # Test symbol table.
 gdb_test "python print (symtab.filename)" ".*${py_symbol_c}" "test symtab.filename"
-gdb_test "python print (symtab.objfile)" "<gdb.Objfile filename=${binfile}>" \
-    "test symtab.objfile"
+gdb_test "python print (symtab.objfile)" \
+    "<gdb.Objfile filename=.*${testfile}.*>" "test symtab.objfile"
 gdb_test "python print (symtab.fullname())" ".*${full_py_symbol_c}" "test symtab.fullname"
 gdb_test "python print (symtab.is_valid())" "True" "test symtab.is_valid()"
 gdb_test "python print (\"qq\" in global_symbols)" "True" "test qq in global symbols"