Don't depend on having a host for testing timeouts against.
authorAdam Sampson <ats@offog.org>
Wed, 22 Jan 2014 13:32:44 +0000 (13:32 +0000)
committerAdam Sampson <ats@offog.org>
Wed, 22 Jan 2014 13:32:44 +0000 (13:32 +0000)
The hardcoded one that used to be in there (which I was never very happy
with) doesn't work any more, so it now defaults to not running that test
at all, unless you give it the -T option.

NEWS
test-rawdog

diff --git a/NEWS b/NEWS
index aa94a3986c9fb5b1c2c371be183ff63a7ca6991f..c9a2567e7f662f69e98bc313c02dc7beae79514a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+- rawdog 2.19
+
+Make test-rawdog not depend on having a host it can test connection
+timeouts against, and add a -T option if you do have one.
+
 - rawdog 2.18
 
 Be consistent about catching AttributeError when looking for attributes
index 50d477078a4a232f7ede40f776ba2f3a2e1ccc58..752e43e808ae1c36c6ee0ac88efda316e001e0b1 100644 (file)
@@ -39,7 +39,7 @@ httpport="8432"
 # (This is distinct from timeoutport above: if you connect to timeoutport, it
 # will accept the connection but not do anything, whereas this will timeout
 # while connecting.)
-timeouthost="81.91.98.19"
+timeouthost=""
 
 httpdir="$statedir/pub"
 httpurl="http://$serverhost:$httpport"
@@ -51,6 +51,7 @@ Usage: test-rawdog [OPTION]...
 -b                           Include tests that are known to fail
 -k                           Keep going when a test fails
 -r COMMAND                   How to invoke rawdog (default: "./rawdog")
+-T HOST                      Host to test connection timeout with
 
 Report bugs to <ats@offog.org>.
 EOF
@@ -60,7 +61,7 @@ EOF
 knownbad=false
 keepgoing=false
 rawdog="./rawdog"
-while getopts bkr: OPT; do
+while getopts bkr:T: OPT; do
        case "$OPT" in
        b)
                knownbad=true
@@ -71,6 +72,9 @@ while getopts bkr: OPT; do
        r)
                rawdog="$OPTARG"
                ;;
+       T)
+               timeouthost="$OPTARG"
+               ;;
        ?)
                usage
                ;;
@@ -825,10 +829,12 @@ add "feed 0 $httpurl/notthere"
 rune "404" -u
 
 for proto in http https ftp; do
-       begin "$proto: connect timeout"
-       add "timeout 1s"
-       add "feed 0 $proto://$timeouthost/feed.xml"
-       rune "Timeout while reading" -u
+       if [ -n "$timeouthost" ]; then
+               begin "$proto: connect timeout"
+               add "timeout 1s"
+               add "feed 0 $proto://$timeouthost/feed.xml"
+               rune "Timeout while reading" -u
+       fi
 
        begin "$proto: response timeout"
        add "timeout 1s"