]> arthur.barton.de Git - bup.git/commitdiff
tests: web: exit early to avoid indentation
authorJohannes Berg <johannes@sipsolutions.net>
Sun, 17 May 2020 19:42:53 +0000 (21:42 +0200)
committerRob Browning <rlb@defaultvalue.org>
Sun, 21 Jun 2020 16:20:58 +0000 (11:20 -0500)
There isn't really much point in assigning a variable if
all we really want is to skip the whole test, just exit
early in those cases.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
t/test-web.sh

index 74e0f2bd4b3d6207622b1114d74614706107f3ea..1b34b8a947baa179fcdba1cab51a91b456058e3e 100755 (executable)
@@ -28,45 +28,41 @@ wait-for-server-start()
 WVPASS cd "$tmpdir"
 
 # FIXME: add WVSKIP
-run_test=true
-
 if test -z "$(type -p curl)"; then
     WVSTART 'curl does not appear to be installed; skipping  test'
-    run_test=''
+    exit 0
 fi
     
 WVPASS bup-python -c "import socket as s; s.socket(s.AF_UNIX).bind('socket')"
 curl -s --unix-socket ./socket http://localhost/foo
 if test $? -ne 7; then
     WVSTART 'curl does not appear to support --unix-socket; skipping test'
-    run_test=''
+    exit 0
 fi
 
 if ! bup-python -c 'import tornado' 2> /dev/null; then
     WVSTART 'unable to import tornado; skipping test'
-    run_test=''
+    exit 0
 fi
 
-if test -n "$run_test"; then
-    WVSTART 'web'
-    WVPASS bup init
-    WVPASS mkdir src
-    WVPASS echo '¡excitement!' > src/data
-    WVPASS bup index src
-    WVPASS bup save -n '¡excitement!' --strip src
+WVSTART 'web'
+WVPASS bup init
+WVPASS mkdir src
+WVPASS echo '¡excitement!' > src/data
+WVPASS bup index src
+WVPASS bup save -n '¡excitement!' --strip src
 
-    "$TOP/bup" web unix://socket &
-    web_pid=$!
-    wait-for-server-start
+"$TOP/bup" web unix://socket &
+web_pid=$!
+wait-for-server-start
 
-    WVPASS curl --unix-socket ./socket \
-           'http://localhost/%C2%A1excitement%21/latest/data' > result
-    WVPASSEQ "$(curl --unix-socket ./socket http://localhost/static/styles.css)" \
-             "$(cat "$TOP/lib/web/static/styles.css")"
+WVPASS curl --unix-socket ./socket \
+       'http://localhost/%C2%A1excitement%21/latest/data' > result
+WVPASSEQ "$(curl --unix-socket ./socket http://localhost/static/styles.css)" \
+         "$(cat "$TOP/lib/web/static/styles.css")"
 
-    WVPASSEQ '¡excitement!' "$(cat result)"
-    WVPASS kill -s TERM "$web_pid"
-    WVPASS wait "$web_pid"
-fi
+WVPASSEQ '¡excitement!' "$(cat result)"
+WVPASS kill -s TERM "$web_pid"
+WVPASS wait "$web_pid"
 
 WVPASS rm -r "$tmpdir"