From faf2a04fa5e4c44a356d635502cc7e2dbead34d3 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 26 May 2010 13:31:41 -0400 Subject: [PATCH] Make test.sh exit with nonzero status if tests fail This behavior makes "make verify" actually fail when the tests fail, which is what it's supposed to do. --- test/test-ratelim.sh | 9 +++++++++ test/test.sh | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/test/test-ratelim.sh b/test/test-ratelim.sh index 201794c4..229cba54 100755 --- a/test/test-ratelim.sh +++ b/test/test-ratelim.sh @@ -1,5 +1,7 @@ #!/bin/sh +FAILED=no + if test "x$TEST_OUTPUT_FILE" = "x" then TEST_OUTPUT_FILE=/dev/null @@ -44,6 +46,7 @@ run_tests () { announce OKAY else announce FAILED + FAILED=yes fi announce_n " Connection limit, no group limit:" @@ -52,6 +55,7 @@ run_tests () { announce OKAY ; else announce FAILED ; + FAILED=yes fi announce_n " Connection limit and group limit:" @@ -60,9 +64,14 @@ run_tests () { announce OKAY ; else announce FAILED ; + FAILED=yes fi } announce "Running rate-limiting tests:" run_tests + +if test "$FAILED" = "yes"; then + exit 1 +fi diff --git a/test/test.sh b/test/test.sh index e132fc38..5b6b5378 100755 --- a/test/test.sh +++ b/test/test.sh @@ -1,5 +1,7 @@ #!/bin/sh +FAILED=no + if test "x$TEST_OUTPUT_FILE" = "x" then TEST_OUTPUT_FILE=/dev/null @@ -62,6 +64,7 @@ run_tests () { announce OKAY ; else announce FAILED ; + FAILED=yes fi announce_n " test-weof: " if $TEST_DIR/test-weof >>"$TEST_OUTPUT_FILE" ; @@ -69,6 +72,7 @@ run_tests () { announce OKAY ; else announce FAILED ; + FAILED=yes fi announce_n " test-time: " if $TEST_DIR/test-time >>"$TEST_OUTPUT_FILE" ; @@ -76,6 +80,7 @@ run_tests () { announce OKAY ; else announce FAILED ; + FAILED=yes fi announce_n " regress: " if $TEST_DIR/regress >>"$TEST_OUTPUT_FILE" ; @@ -83,6 +88,7 @@ run_tests () { announce OKAY ; else announce FAILED ; + FAILED=yes fi } @@ -123,3 +129,7 @@ setup unset EVENT_NOWIN32 announce "WIN32" run_tests + +if test "$FAILED" = "yes"; then + exit 1 +fi -- 2.40.0