[RFA] Make test names unique in python.exp and guile.exp

Pedro Alves palves@redhat.com
Tue Jun 23 21:43:43 GMT 2020


On 6/23/20 10:32 PM, Simon Marchi wrote:
> On 2020-06-23 4:51 p.m., Philippe Waroquiers via Gdb-patches wrote:
>> +	if {[gdb_test_multiple $input "$name - $input" {
>> +	    -re "\[\r\n\]*($result)\[\r\n\]+($gdb_prompt | *>)$" {
>> +		pass "$name - $input (input nr $inputnr)"
> 
> The test name passed as the second argument of `gdb_test_multiple` and the test
> name passed to `pass` should match.  This is why the special variable $gdb_test_name
> was added, to avoid potential mismatches.  You can use "pass $gdb_test_name" inside
> the gdb_test_multiple body.

Text within the "(xxx)" at the end is considered informational, not
part of the test name, though.  That's why we avoid trailing parens
in general.  So in this case they do match.  Just like these match:

 PASS: foo
 FAIL: foo (timeout)

Still a good idea to write:

 pass "$gdb_test_name (input nr $inputnr)"

though.

There were other cases in the patch that didn't match though.  Like:

>  gdb_test_multiple "python gdb.prompt_hook = prompt" "set the hook" {
>      -re "\[\r\n\]$newprompt $" {
> -	pass "set hook"
> +	pass "set hook prompt"
>      }
>  }

Here this can result in either:

 FAIL: set the hook
 PASS: set hook prompt

Pedro Alves



More information about the Gdb-patches mailing list