[PATCH 2/4] gdb/testsuite: Detect and warn if paths are used in test names
Andrew Burgess
andrew.burgess@embecosm.com
Mon Apr 27 19:06:03 GMT 2020
* Keith Seitz <keiths@redhat.com> [2020-04-27 09:42:30 -0700]:
> On 4/27/20 8:58 AM, Andrew Burgess wrote:
> > * Keith Seitz <keiths@redhat.com> [2020-04-23 13:26:30 -0700]:
> >>> +set local_record_procs(pass) "check_test_names"
> >>> +set local_record_procs(fail) "check_test_names"
> >>> +set local_record_procs(xfail) "check_test_names"
> >>> +set local_record_procs(kfail) "check_test_names"
> >>> +set local_record_procs(xpass) "check_test_names"
> >>> +set local_record_procs(kpass) "check_test_names"
> >>> +set local_record_procs(unresolved) "check_test_names"
> >>> +set local_record_procs(untested) "check_test_names"
> >>> +set local_record_procs(unsupported) "check_test_names"
> >>
> >> Since I failed to contain the Tcl pedantic in me, the above
> >> can be more Tcl-ishly written with `array set', but I am not
> >> requesting that you change anything. Just FYI.
> >
> > Thanks for your feedback, I'm making a few changes to the patch, but I
> > wanted to follow up on the 'array set' issue, I'd like to get things
> > right where I can, however, in this case....
> >
> > $ tclsh
> > % array set foo {}
> > % array set foo(bar) 1
> > list must have an even number of elements
> >
> > This is inline with what I see when I try to use 'array set ....'
> > within the Dejagnu script, I get the error 'list must have an even
> > number of elements'.
> >
> > Is there something I'm doing wrong here? Or is 'array set' not
> > actually needed in this case?
>
> To be clear -- I apologize if I wasn't earlier -- you do not /need/
> to use array set. As I mentioned, the more Tcl-ish way to write large
> array initializations is
>
> array set local_record_procs {
> pass check_test_names
> fail check_test_names
> # ...
> }
>
> "array set" takes a list of key-value pairs, so there must be
> an even number of elements in the list.
>
> However, in hindsight, since all these are being set to the same
> value, an even more Tcl-ish way:
>
> foreach nm {pass fail xfail kfail xpass kpass unresolved untested unsupported} {
> set local_record_procs($nm) check_test_names
> }
>
> [While tempting to use "[array names local_record_procs]", reading framework.exp
> shows that this array is not actually expected to exist, so we have to
> explicitly list out all test result outcomes.]
>
> Okay, that was probably way more hassle than necessary... I promise to
> backburner my [counterproductive] Tcl pedantic-ness[sic]!
No, it's not a problem. Dejagnu / TCL isn't likely to go anywhere
anytime soon, so it's always good to learn more.
I'll incorporate your suggested foreach loop improvement.
Thanks,
Andrew
More information about the Gdb-patches
mailing list