Re: [patch, testsuite] Fixes for gdb.python tests on remote Windows host

Simon Marchi
2019-08-13T01:46:30Z

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