From: Junio C Hamano <hidden> Date: 2016-06-15 22:42:14
Amos Waterland [off-list ref] writes:
Do not let errors pass by unnoticed when running `make check'.
...
check:
- for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i; done
+ for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || break; done
Good point but "|| exit" would be more appropriate. With the
above patch, I suspect "make check" merely stops at the first
error but resulting return code would still be zero, wouldn't
it?
$ cat Makefile
check1:
for i in 1 2 3 4; do echo testing $$i; test $$i -le 2 || break; done
check2:
for i in 1 2 3 4; do echo testing $$i; test $$i -le 2 || exit; done
$ make check1
for i in 1 2 3 4; do echo testing $i; test $i -le 2 || break; done
testing 1
testing 2
testing 3
$ make check2
for i in 1 2 3 4; do echo testing $i; test $i -le 2 || exit; done
testing 1
testing 2
testing 3
make: *** [check2] Error 1
$ exit
On Wed, Dec 14, 2005 at 01:30:16PM -0800, Junio C Hamano wrote:
Good point but "|| exit" would be more appropriate. With the
above patch, I suspect "make check" merely stops at the first
error but resulting return code would still be zero, wouldn't
it?
Yes, here is a patch that uses exit instead of break.
---
Do not let errors pass by unnoticed when running `make check'.
Signed-off-by: Amos Waterland <redacted>
---
Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
bc721e2d99487c0240514a848ac1cb84c086e008
check:
- for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i; done
+ for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || break; done
Actually, you might be better off with just
sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) *.c
these days. It will cause some interesting warnings (it actually
cross-checks things, and is unhappy about multiple "main()" declarations
with different types ;), but especially with eventual libification it
might even be a good idea to try to avoid global functions with the same
names in different programs ("main", of course, is special, sparse is
just too stupid to know).
Linus