[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: BSD (+/bin/sh) vs. GNU make -- `make check'

From: Garance A Drosihn <drosih_at_rpi.edu>
Date: 2001-06-19 22:08:25 CEST

At 10:14 PM -0500 6/17/01, Ben Collins-Sussman wrote:
>This bit of code from Makefile.in is part of the 'check' target:
>
> echo "START: $$progbase" >> $$logfile ; \
> (cd $$progdir && ./$$progbase $(abs_srcdir)) >> $$logfile ; \
> if test $$? -eq 0; then \
> echo "SUCCESS" ; \
> else \
> failed=yes; \
> echo "FAILED" ; \
> echo "--- at least one sub-test FAILED, check tests.log." ; \
> fi; \
> echo "END: $$progbase" >> $$logfile ; \
>
>
>The problem I'm noticing on my FreeBSD systems: if one of the test
>programs returns non-zero, we never see the "FAILED" message in the
>else clause. Instead, the BSD version of 'make' simply bombs out on
>the spot and prints "*** Error code N".

I was just in this area on freebsd, fixing a similar problem. Some
automake-generated make targets would fail with '*** Error code n'
when they should not have. I did fix that issue in freebsd-current,
and will be copying the fix to freebsd-stable sometime soon. That
doesn't fix things for the above, though.

>I'd like to not be dependent on the fact that GNU make is more
>tolerant than others. Is there a way to change the script above
>so that older 'make's won't instantly bomb on error?

Note that in freebsd-land (at least), this is not an issue with
'make', it is an issue with '/bin/sh'. As far as 'make' is
concerned, that whole mess above is a single command which it
executes using '/bin/sh -e' processing. It is the shell that
is deciding to error-out.

There is a trick to how the shell handles error-check processing.
It wants to know you're checking the status of the just-finished
command before it starts to execute the next command. (at least,
I think that is it's intent). So, the command-which-might-fail
must be IN the 'if', or it must be tested by using '||' or '&&'
for the command-separator.

so, you tend to do things like:
    cmdok=NO ; cd $$progdir && ./$$prog >> $$log && cmdok=YES

The cmdok=YES part will only be executed if both the 'cd' and '$prog'
worked. You then check the value of cmdok in the 'if' statement.

-- 
Garance Alistair Drosehn            =   gad@eclipse.acs.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:32 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.