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

Sandra Loosemore
2019-08-13T02:31:36Z

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