bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests/init.sh: new file to be used via most *.sh tests


From: Ralf Wildenhues
Subject: Re: [PATCH] tests/init.sh: new file to be used via most *.sh tests
Date: Fri, 27 Nov 2009 22:13:03 +0100
User-agent: Mutt/1.5.20 (2009-08-09)

* Jim Meyering wrote on Fri, Nov 27, 2009 at 10:03:10PM CET:
> > so just a couple of notes: Automake has a similar file tests/defs.in
> > that is not as elaborate; still, you might be able to profit from it.
> > For example, turning on VERBOSE if srcdir is not set but derived from
> > $0 is very handy: it typically causes manual
> > $ ../../source/tests/foo.test
> 
> In tests/defs.in the only use of VERBOSE is to unset it.
> I'll look further tomorrow.

Ah yes, sorry, the code was removed when the testsuite moved to use the
parallel-tests Automake option: that allowed tests to be verbose by
default (because the test driver catches output).  See commit 9aa1e525.

> >> +# Run the user-overridable cleanup_ function, remove the temporary
> >> +# directory and exit with the incoming value of $?.
> >> +remove_tmp_()
> >> +{
> >> +  __st=$?
> >
> > Have you checked whether using this function in a trap 0 correctly
> > catches $? with FreeBSD sh?  I'm thinking of (autoconf.info):
> >
> >      The shell in FreeBSD 4.0 has the following bug: `$?' is reset to 0
> >      by empty lines if the code is inside `trap'.
> 
> Thanks, but that code has been in coreutils' test-lib.sh
> for a long time without reports of trouble, so I'm not worried.

Well, the effect would have been less visible failures; such a bug can
potentially go undetected for a long time.  :-/

> And besides, since FreeBSD 8.0 was just released, I won't lose
> sleep over portability problems in 4.0.

Oh, we should update the text, this bug is definitely still in 6.4.

Also, and this was what I was thinking of for a second but then forgot:
(autoconf.info)Shell Functions:

   Likewise, the state of `$?' is not reliable when entering a shell
function.  This has the effect that using a function as the first
command in a `trap' handler can cause problems.

     $ bash -c 'foo(){ echo $?; }; trap foo 0; (exit 2); exit 2'; echo $?
     2
     2
     $ ash -c 'foo(){ echo $?; }; trap foo 0; (exit 2); exit 2'; echo $?
     0
     2

This affects FreeBSD 6.4 sh as well.

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]