Skip to content

Commit

Permalink
Exit with a non-zero status when tests failed
Browse files Browse the repository at this point in the history
  • Loading branch information
pietern committed May 29, 2011
1 parent 1c29aaf commit 7a8de1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ check: hiredis-test
"bind 127.0.0.1\n" \
"unixsocket /tmp/hiredis-test-redis.sock" \
| redis-server -
./hiredis-test -h 127.0.0.1 -p 56379 -s /tmp/hiredis-test-redis.sock || true
./hiredis-test -h 127.0.0.1 -p 56379 -s /tmp/hiredis-test-redis.sock || \
( kill `cat /tmp/hiredis-test-redis.pid` && false )
kill `cat /tmp/hiredis-test-redis.pid`

.c.o:
Expand Down
7 changes: 4 additions & 3 deletions test.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,10 +704,11 @@ int main(int argc, char **argv) {
test_blocking_io_errors(cfg);
test_throughput(cfg);

if (fails == 0) {
printf("ALL TESTS PASSED\n");
} else {
if (fails) {
printf("*** %d TESTS FAILED ***\n", fails);
return 1;
}

printf("ALL TESTS PASSED\n");
return 0;
}

0 comments on commit 7a8de1f

Please sign in to comment.