gdb/testsuite: handle long filenames in gdb.base/startup-with-shell.exp

Message ID 8be51f9325a83a446404cf595bbe60b330af79e0.1705485491.git.aburgess@redhat.com
State New
Headers
Series gdb/testsuite: handle long filenames in gdb.base/startup-with-shell.exp |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Andrew Burgess Jan. 17, 2024, 9:58 a.m. UTC
  I got a report of a failure from Linaro's CI testing for the test
gdb.base/startup-with-shell.exp.

Looking at the log I see this:

  (gdb) PASS: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: inferior started
  print argv[1]
  $1 = 0xfffed978 "/home/tcwg-build/workspace/tcwg_gnu_4/abe/builds/armv8l-unknown-linux-gnueabihf/armv8l-unknown-linux-gnueabihf/gdb-gdb.git~master/gdb/testsuite/outputs/gdb.base/startup-with-shell/unique-file.unique-e"...
  (gdb) FAIL: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: first argument expanded

Notice that the value of $1 was truncated (indicated by the trailing
ellipses), and as a result it isn't going to match the expected output
pattern.

Avoid this by adding a call to 'set print characters unlimited' which
allows GDB to print strings of any length.
---
 gdb/testsuite/gdb.base/startup-with-shell.exp | 1 +
 1 file changed, 1 insertion(+)


base-commit: 1b346e50485ee450e8103e4b1704b43f61bc39f7
  

Comments

Tom de Vries Jan. 17, 2024, 11:24 a.m. UTC | #1
On 1/17/24 10:58, Andrew Burgess wrote:
> I got a report of a failure from Linaro's CI testing for the test
> gdb.base/startup-with-shell.exp.
> 
> Looking at the log I see this:
> 
>    (gdb) PASS: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: inferior started
>    print argv[1]
>    $1 = 0xfffed978 "/home/tcwg-build/workspace/tcwg_gnu_4/abe/builds/armv8l-unknown-linux-gnueabihf/armv8l-unknown-linux-gnueabihf/gdb-gdb.git~master/gdb/testsuite/outputs/gdb.base/startup-with-shell/unique-file.unique-e"...
>    (gdb) FAIL: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: first argument expanded
> 
> Notice that the value of $1 was truncated (indicated by the trailing
> ellipses), and as a result it isn't going to match the expected output
> pattern.
> 
> Avoid this by adding a call to 'set print characters unlimited' which
> allows GDB to print strings of any length.

Hi Andrew,

LGTM.

I don't see the FAIL in my usual setup, but I managed to reproduce it by 
using "set print characters 20".

FWIW, I noticed with target native-extended-gdbserver:
...
FAIL: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args 
= *.unique-extension: first argument expanded
FAIL: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args 
= $TEST: testing first argument
...
but that's both with and without your patch.  PR28392 ( 
https://sourceware.org/bugzilla/show_bug.cgi?id=28392 ) looks related.

Approved-By: Tom de Vries <tdevries@suse.de>

Thanks,
- Tom

> ---
>   gdb/testsuite/gdb.base/startup-with-shell.exp | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/gdb/testsuite/gdb.base/startup-with-shell.exp b/gdb/testsuite/gdb.base/startup-with-shell.exp
> index b73d5d740f5..d5ec503dceb 100644
> --- a/gdb/testsuite/gdb.base/startup-with-shell.exp
> +++ b/gdb/testsuite/gdb.base/startup-with-shell.exp
> @@ -59,6 +59,7 @@ proc initial_setup_simple { startup_with_shell run_args } {
>   
>   with_test_prefix "startup_with_shell = on; run_args = *.unique-extension" {
>       initial_setup_simple "on" "$unique_file_dir/*.unique-extension"
> +    gdb_test_no_output "set print characters unlimited"
>       gdb_test "print argv\[1\]" "\\\$$decimal = $hex \"$unique_file\"" \
>   	"first argument expanded"
>   }
> 
> base-commit: 1b346e50485ee450e8103e4b1704b43f61bc39f7
  
Andrew Burgess Jan. 17, 2024, 3:32 p.m. UTC | #2
Tom de Vries <tdevries@suse.de> writes:

> On 1/17/24 10:58, Andrew Burgess wrote:
>> I got a report of a failure from Linaro's CI testing for the test
>> gdb.base/startup-with-shell.exp.
>> 
>> Looking at the log I see this:
>> 
>>    (gdb) PASS: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: inferior started
>>    print argv[1]
>>    $1 = 0xfffed978 "/home/tcwg-build/workspace/tcwg_gnu_4/abe/builds/armv8l-unknown-linux-gnueabihf/armv8l-unknown-linux-gnueabihf/gdb-gdb.git~master/gdb/testsuite/outputs/gdb.base/startup-with-shell/unique-file.unique-e"...
>>    (gdb) FAIL: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: first argument expanded
>> 
>> Notice that the value of $1 was truncated (indicated by the trailing
>> ellipses), and as a result it isn't going to match the expected output
>> pattern.
>> 
>> Avoid this by adding a call to 'set print characters unlimited' which
>> allows GDB to print strings of any length.
>
> Hi Andrew,
>
> LGTM.
>
> I don't see the FAIL in my usual setup, but I managed to reproduce it by 
> using "set print characters 20".
>
> FWIW, I noticed with target native-extended-gdbserver:
> ...
> FAIL: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args 
> = *.unique-extension: first argument expanded
> FAIL: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args 
> = $TEST: testing first argument
> ...
> but that's both with and without your patch.  PR28392 ( 
> https://sourceware.org/bugzilla/show_bug.cgi?id=28392 ) looks related.

These failures (along with a lot of other problems) are fixed by this series:

  https://inbox.sourceware.org/gdb-patches/cover.1704809585.git.aburgess@redhat.com

Thanks,
Andrew

>
> Approved-By: Tom de Vries <tdevries@suse.de>
>
> Thanks,
> - Tom
>
>> ---
>>   gdb/testsuite/gdb.base/startup-with-shell.exp | 1 +
>>   1 file changed, 1 insertion(+)
>> 
>> diff --git a/gdb/testsuite/gdb.base/startup-with-shell.exp b/gdb/testsuite/gdb.base/startup-with-shell.exp
>> index b73d5d740f5..d5ec503dceb 100644
>> --- a/gdb/testsuite/gdb.base/startup-with-shell.exp
>> +++ b/gdb/testsuite/gdb.base/startup-with-shell.exp
>> @@ -59,6 +59,7 @@ proc initial_setup_simple { startup_with_shell run_args } {
>>   
>>   with_test_prefix "startup_with_shell = on; run_args = *.unique-extension" {
>>       initial_setup_simple "on" "$unique_file_dir/*.unique-extension"
>> +    gdb_test_no_output "set print characters unlimited"
>>       gdb_test "print argv\[1\]" "\\\$$decimal = $hex \"$unique_file\"" \
>>   	"first argument expanded"
>>   }
>> 
>> base-commit: 1b346e50485ee450e8103e4b1704b43f61bc39f7
  
Tom de Vries Jan. 17, 2024, 4:01 p.m. UTC | #3
On 1/17/24 16:32, Andrew Burgess wrote:
> Tom de Vries <tdevries@suse.de> writes:
> 
>> On 1/17/24 10:58, Andrew Burgess wrote:
>>> I got a report of a failure from Linaro's CI testing for the test
>>> gdb.base/startup-with-shell.exp.
>>>
>>> Looking at the log I see this:
>>>
>>>     (gdb) PASS: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: inferior started
>>>     print argv[1]
>>>     $1 = 0xfffed978 "/home/tcwg-build/workspace/tcwg_gnu_4/abe/builds/armv8l-unknown-linux-gnueabihf/armv8l-unknown-linux-gnueabihf/gdb-gdb.git~master/gdb/testsuite/outputs/gdb.base/startup-with-shell/unique-file.unique-e"...
>>>     (gdb) FAIL: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: first argument expanded
>>>
>>> Notice that the value of $1 was truncated (indicated by the trailing
>>> ellipses), and as a result it isn't going to match the expected output
>>> pattern.
>>>
>>> Avoid this by adding a call to 'set print characters unlimited' which
>>> allows GDB to print strings of any length.
>>
>> Hi Andrew,
>>
>> LGTM.
>>
>> I don't see the FAIL in my usual setup, but I managed to reproduce it by
>> using "set print characters 20".
>>
>> FWIW, I noticed with target native-extended-gdbserver:
>> ...
>> FAIL: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args
>> = *.unique-extension: first argument expanded
>> FAIL: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args
>> = $TEST: testing first argument
>> ...
>> but that's both with and without your patch.  PR28392 (
>> https://sourceware.org/bugzilla/show_bug.cgi?id=28392 ) looks related.
> 
> These failures (along with a lot of other problems) are fixed by this series:
> 
>    https://inbox.sourceware.org/gdb-patches/cover.1704809585.git.aburgess@redhat.com
> 

Thanks, I've added a note in the PR.

- Tom

> Thanks,
> Andrew
> 
>>
>> Approved-By: Tom de Vries <tdevries@suse.de>
>>
>> Thanks,
>> - Tom
>>
>>> ---
>>>    gdb/testsuite/gdb.base/startup-with-shell.exp | 1 +
>>>    1 file changed, 1 insertion(+)
>>>
>>> diff --git a/gdb/testsuite/gdb.base/startup-with-shell.exp b/gdb/testsuite/gdb.base/startup-with-shell.exp
>>> index b73d5d740f5..d5ec503dceb 100644
>>> --- a/gdb/testsuite/gdb.base/startup-with-shell.exp
>>> +++ b/gdb/testsuite/gdb.base/startup-with-shell.exp
>>> @@ -59,6 +59,7 @@ proc initial_setup_simple { startup_with_shell run_args } {
>>>    
>>>    with_test_prefix "startup_with_shell = on; run_args = *.unique-extension" {
>>>        initial_setup_simple "on" "$unique_file_dir/*.unique-extension"
>>> +    gdb_test_no_output "set print characters unlimited"
>>>        gdb_test "print argv\[1\]" "\\\$$decimal = $hex \"$unique_file\"" \
>>>    	"first argument expanded"
>>>    }
>>>
>>> base-commit: 1b346e50485ee450e8103e4b1704b43f61bc39f7
>
  

Patch

diff --git a/gdb/testsuite/gdb.base/startup-with-shell.exp b/gdb/testsuite/gdb.base/startup-with-shell.exp
index b73d5d740f5..d5ec503dceb 100644
--- a/gdb/testsuite/gdb.base/startup-with-shell.exp
+++ b/gdb/testsuite/gdb.base/startup-with-shell.exp
@@ -59,6 +59,7 @@  proc initial_setup_simple { startup_with_shell run_args } {
 
 with_test_prefix "startup_with_shell = on; run_args = *.unique-extension" {
     initial_setup_simple "on" "$unique_file_dir/*.unique-extension"
+    gdb_test_no_output "set print characters unlimited"
     gdb_test "print argv\[1\]" "\\\$$decimal = $hex \"$unique_file\"" \
 	"first argument expanded"
 }