Re: [patch]: testsuite: run bash instead of sh when using brace expansion

Tom Tromey
2013-05-17T16:44:50Z

>>>>> ">" == Christian Groessler <chris@groessler.org> writes:

>> How about the following patch? My tcl fu is not that strong, so I
>> explicitly wrote out the expanded strings instead of computing them.

You can do something like:

set dirs {}
foreach l {/ldir ""} {
foreach r {/rdir ""} {
... more foreaches here ...
lappend dirs [join [list $l $r $...]]
}
}

>> The shell command line could get quite long with this change,
>> depending how deep
>> the build directory is located in the hierarchy. I could invoke the
>> shell for each path separately, but
>> this would be slower. Any opinions?

If the result is too long we could batch it.
But I would not worry about it for now.

>> +proc reverse {lst} {

We have 'lreverse' in new Tcl, plus a compatibility proc in future.exp.

>> +proc pathexpand {prefix dirlst suffix} {
>> + set retlst {}
>> + for {set i 0} {$i < [llength $dirlst]} {incr i} {
>> + lappend retlst "$prefix[lindex $dirlst $i]$suffix"
>> + }
>> + return $retlst

foreach is more idiomatic.

Tom