X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=t%2Ftest-web.sh;h=24a68a4109c97fc2a9701908d03f99831ec440fd;hb=73f4b83af6c73a0ba48e448883856bf24aacbf7d;hp=dd46194ab9ac8e178e6de4aa3048a56e6d8cb3a3;hpb=a90bf7336600c488fa0696b7d202247bd0533c36;p=bup.git diff --git a/t/test-web.sh b/t/test-web.sh index dd46194..24a68a4 100755 --- a/t/test-web.sh +++ b/t/test-web.sh @@ -28,38 +28,45 @@ 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 --unix-socket ./socket http://localhost/foo +WVPASS bup-cfg-py -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' + exit 0 fi - -if test -n "$run_test"; then - WVSTART 'web' - WVPASS bup init - WVPASS mkdir src - WVPASS echo 'éxcitement' > src/data - WVPASS bup index src - WVPASS bup save -n 'éxcitement' --strip src - "$TOP/bup" web unix://socket & - web_pid=$! - wait-for-server-start +WVSTART 'web' +WVPASS bup init +WVPASS mkdir src +WVPASS echo '¡excitement!' > src/data +WVPASS echo -e 'whee \x80\x90\xff' > "$(echo -ne 'src/whee \x80\x90\xff')" +WVPASS bup index src +WVPASS bup save -n '¡excitement!' --strip src - WVPASS curl --unix-socket ./socket \ - 'http://localhost/%C3%A9xcitement/latest/data' > result +"$TOP/bup" web unix://socket & +web_pid=$! +wait-for-server-start - WVPASSEQ 'éxcitement' "$(cat result)" - WVPASS kill -s TERM "$web_pid" - WVPASS wait "$web_pid" -fi +WVPASS curl --unix-socket ./socket \ + 'http://localhost/%C2%A1excitement%21/latest/data' > result +WVPASS curl --unix-socket ./socket \ + 'http://localhost/%C2%A1excitement%21/latest/whee%20%80%90%ff' > result2 +WVPASSEQ "$(curl --unix-socket ./socket http://localhost/static/styles.css)" \ + "$(cat "$TOP/lib/web/static/styles.css")" + +WVPASSEQ '¡excitement!' "$(cat result)" +WVPASS cmp "$(echo -ne 'src/whee \x80\x90\xff')" result2 +WVPASS kill -s TERM "$web_pid" +WVPASS wait "$web_pid" WVPASS rm -r "$tmpdir"