From 7a8de1fe25dda6187d68ec6570a831394cb127d1 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Sun, 29 May 2011 10:03:39 -0700 Subject: Exit with a non-zero status when tests failed --- Makefile | 3 ++- test.c | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f8e5cca..31bb71b 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/test.c b/test.c index dae9c7e..ee028cc 100644 --- a/test.c +++ b/test.c @@ -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; } -- cgit v1.2.3