2 . wvtest-bup.sh || exit $?
3 . dev/lib.sh || exit $?
7 TOP="$(WVPASS pwd)" || exit $?
8 tmpdir="$(WVPASS wvmktempdir)" || exit $?
9 export BUP_DIR="$tmpdir/bup"
16 wait-for-server-start()
18 curl --unix-socket ./socket http://localhost/
20 while test $curl_status -eq 7; do
22 curl --unix-socket ./socket http://localhost/
25 WVPASSEQ $curl_status 0
30 if test -z "$(type -p curl)"; then
31 WVSKIP 'curl does not appear to be installed; skipping test'
35 WVPASS bup-cfg-py -c "import socket as s; s.socket(s.AF_UNIX).bind('socket')"
36 curl -s --unix-socket ./socket http://localhost/foo
37 if test $? -ne 7; then
38 WVSKIP 'curl does not appear to support --unix-socket; skipping test'
42 if ! bup-python -c 'import tornado' 2> /dev/null; then
43 WVSKIP 'unable to import tornado; skipping test'
50 WVPASS echo '¡excitement!' > src/data
51 WVPASS echo -e 'whee \x80\x90\xff' > "$(echo -ne 'src/whee \x80\x90\xff')"
53 WVPASS bup save -n '¡excitement!' --strip src
55 "$TOP/bup" web unix://socket </dev/null >bup-web.log 2>&1 &
57 # output the log if something fails
58 trap 'cat bup-web.log' EXIT
61 WVPASS curl --unix-socket ./socket \
62 'http://localhost/%C2%A1excitement%21/latest/data' > result
63 WVPASS curl --unix-socket ./socket \
64 'http://localhost/%C2%A1excitement%21/latest/whee%20%80%90%ff' > result2
65 WVPASSEQ "$(curl --unix-socket ./socket http://localhost/static/styles.css)" \
66 "$(cat "$TOP/lib/web/static/styles.css")"
68 WVPASSEQ '¡excitement!' "$(cat result)"
69 WVPASS cmp "$(echo -ne 'src/whee \x80\x90\xff')" result2
70 WVPASS kill -s TERM "$web_pid"
71 WVPASS wait "$web_pid"
74 WVPASS rm -r "$tmpdir"