Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v3] arc: Don't use multiline in arc-disassembler-options.exp test
@ 2024-02-12  9:59 Yuriy Kolerov
  2024-02-12 10:14 ` Shahab Vahedi
  2024-02-12 10:27 ` Andreas Schwab
  0 siblings, 2 replies; 4+ messages in thread
From: Yuriy Kolerov @ 2024-02-12  9:59 UTC (permalink / raw)
  To: gdb-patches, Shahab Vahedi

Breaking a TCL string to several lines leads to adding of extra
symbols to the resulting expect string. In turn, this leads to
failing of all test cases in gdb.arch/arc-disassembler-options.exp
testsuite. It's necessary to use multi_line function in such
cases.

Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
---
 gdb/testsuite/gdb.arch/arc-disassembler-options.exp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/arc-disassembler-options.exp b/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
index 655edcc774b..497e0aba91e 100644
--- a/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
@@ -28,10 +28,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {}] \
 clean_restart ${objfile}
 
 proc arc_disassemble_test { func insn mesg } {
-    gdb_test "disassemble $func" \
-	"Dump of assembler code for function $func:\r\n\
-	\[^:\]+:\t$insn\r\nEnd of assembler dump\." \
-	$mesg
+    set pass_re [multi_line \
+			"Dump of assembler code for function $func:" \
+			"\[^:\]+:\t$insn" \
+			"End of assembler dump\."]
+    gdb_test "disassemble $func" $pass_re $mesg
 }
 
 # Verify defaults.
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] arc: Don't use multiline in arc-disassembler-options.exp test
  2024-02-12  9:59 [PATCH v3] arc: Don't use multiline in arc-disassembler-options.exp test Yuriy Kolerov
@ 2024-02-12 10:14 ` Shahab Vahedi
  2024-02-12 10:27 ` Andreas Schwab
  1 sibling, 0 replies; 4+ messages in thread
From: Shahab Vahedi @ 2024-02-12 10:14 UTC (permalink / raw)
  To: Yuriy Kolerov; +Cc: gdb-patches, Tom Tromey

On 2/12/24 10:59, Yuriy Kolerov wrote:
> Breaking a TCL string to several lines leads to adding of extra
> symbols to the resulting expect string. In turn, this leads to
> failing of all test cases in gdb.arch/arc-disassembler-options.exp
> testsuite. It's necessary to use multi_line function in such
> cases.
> 
> Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>

Looks good to me. Thank you!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] arc: Don't use multiline in arc-disassembler-options.exp test
  2024-02-12  9:59 [PATCH v3] arc: Don't use multiline in arc-disassembler-options.exp test Yuriy Kolerov
  2024-02-12 10:14 ` Shahab Vahedi
@ 2024-02-12 10:27 ` Andreas Schwab
  2024-02-12 15:33   ` Tom de Vries
  1 sibling, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2024-02-12 10:27 UTC (permalink / raw)
  To: Yuriy Kolerov; +Cc: gdb-patches, Shahab Vahedi

On Feb 12 2024, Yuriy Kolerov wrote:

> diff --git a/gdb/testsuite/gdb.arch/arc-disassembler-options.exp b/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
> index 655edcc774b..497e0aba91e 100644
> --- a/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
> +++ b/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
> @@ -28,10 +28,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {}] \
>  clean_restart ${objfile}
>  
>  proc arc_disassemble_test { func insn mesg } {
> -    gdb_test "disassemble $func" \
> -	"Dump of assembler code for function $func:\r\n\
> -	\[^:\]+:\t$insn\r\nEnd of assembler dump\." \
> -	$mesg
> +    set pass_re [multi_line \
> +			"Dump of assembler code for function $func:" \
> +			"\[^:\]+:\t$insn" \
> +			"End of assembler dump\."]

If you want to regexp-quote a period, you need to write it as "\\.", so
that the backslash is not eaten by the string reader.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] arc: Don't use multiline in arc-disassembler-options.exp test
  2024-02-12 10:27 ` Andreas Schwab
@ 2024-02-12 15:33   ` Tom de Vries
  0 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2024-02-12 15:33 UTC (permalink / raw)
  To: Andreas Schwab, Yuriy Kolerov; +Cc: gdb-patches, Shahab Vahedi

On 2/12/24 11:27, Andreas Schwab wrote:
> On Feb 12 2024, Yuriy Kolerov wrote:
> 
>> diff --git a/gdb/testsuite/gdb.arch/arc-disassembler-options.exp b/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
>> index 655edcc774b..497e0aba91e 100644
>> --- a/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
>> +++ b/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
>> @@ -28,10 +28,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {}] \
>>   clean_restart ${objfile}
>>   
>>   proc arc_disassemble_test { func insn mesg } {
>> -    gdb_test "disassemble $func" \
>> -	"Dump of assembler code for function $func:\r\n\
>> -	\[^:\]+:\t$insn\r\nEnd of assembler dump\." \
>> -	$mesg
>> +    set pass_re [multi_line \
>> +			"Dump of assembler code for function $func:" \
>> +			"\[^:\]+:\t$insn" \
>> +			"End of assembler dump\."]
> 
> If you want to regexp-quote a period, you need to write it as "\\.", so
> that the backslash is not eaten by the string reader.
> 

FWIW, it's also possible to let string_to_regexp worry about escaping, 
and use:
...
+			[string_to_regexp "End of assembler dump."]]
...

Thanks,
- Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-12 15:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12  9:59 [PATCH v3] arc: Don't use multiline in arc-disassembler-options.exp test Yuriy Kolerov
2024-02-12 10:14 ` Shahab Vahedi
2024-02-12 10:27 ` Andreas Schwab
2024-02-12 15:33   ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox