[PATCH] remove bashisms from xfstests
Dave Chinner
david at fromorbit.com
Wed Jan 6 16:36:31 CST 2010
On Wed, Jan 06, 2010 at 11:24:10AM -0800, Christian Kujau wrote:
> On Wed, 6 Jan 2010 at 11:48, Christoph Hellwig wrote:
> > > 2) convert "let..." into something (hopefully) more portable
> >
> > Dave converted these away from expr due to performance reasons. I'd
> > like too see a prove that performance hasn't regressed due to this
> > change.
>
> That's why I hesitated to just change all scripts to /bin/bash, but didn't
> dare to say so, because of the inevitable "but today's computers are fast
> enough" reactions :-)
FYI - the problem I came across was to do with running xfsqa under UML,
where forking a new process is an expensive operation (I measured it
at about 300ms) and so using bash built-in expressions for
incrementing variables is a major win in terms of test run time.
IIRC, one test loops 100,000 times and the runtime went from half an
hour to 10s just by using "let n=n+1" instead of expr...
>
> > > 3) replace 'a == b' with 'a = b' in bourne shell scripts
> >
> > This looks fine. If you want feel free to submit these as a separate
> > first patch so that we have the large pile sorted out.
>
> OK, will do.
>
> > I fear this might cause some overhead in the shell. What about the
> > following instead:
> >
> > for i in `seq 0 39`; do
> > ln -s $o symlink_$i
> > o=symlink_$i
> > done
>
> I didn't go for seq(1), as I feared this wouldn't be available on every
> machine.
seq(1) is already used in several tests, so it is ok to use in
more. :)
Cheers,
Dave.
--
Dave Chinner
david at fromorbit.com
More information about the xfs
mailing list