]> granicus.if.org Git - libevent/commitdiff
Make test.sh exit with nonzero status if tests fail
authorNick Mathewson <nickm@torproject.org>
Wed, 26 May 2010 17:31:41 +0000 (13:31 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 26 May 2010 17:43:01 +0000 (13:43 -0400)
This behavior makes "make verify" actually fail when the tests fail,
which is what it's supposed to do.

test/test-ratelim.sh
test/test.sh

index 201794c46f8003fac55d0d3db84b25f43e3a0ae8..229cba548116f5a9c54d617b6af7f1370f50d220 100755 (executable)
@@ -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
index e132fc381ba7f21ddae4034cedfda7fe5e23ff48..5b6b5378a828b21c7b628d1775c8f16585437ed9 100755 (executable)
@@ -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