summaryrefslogtreecommitdiff
path: root/test/hg-web
diff options
context:
space:
mode:
authorAssaf Gordon <assafgordon@gmail.com>2017-01-12 19:41:36 (GMT)
committerAssaf Gordon <assafgordon@gmail.com>2017-01-12 19:41:36 (GMT)
commit833ec293858d40d7cf98d5b37c92fc642a241033 (patch)
treed0e3991a01ab1c42ac8b67e79b8f5a93635e94e8 /test/hg-web
parent35be2c5bcf958128ed6254ed1a8b814d17c6640d (diff)
downloadsavannah-tests-833ec293858d40d7cf98d5b37c92fc642a241033.zip
savannah-tests-833ec293858d40d7cf98d5b37c92fc642a241033.tar.gz
savannah-tests-833ec293858d40d7cf98d5b37c92fc642a241033.tar.bz2
new tests: hg-{hg,rsync,ssh,web}
Diffstat (limited to 'test/hg-web')
-rwxr-xr-xtest/hg-web89
1 files changed, 89 insertions, 0 deletions
diff --git a/test/hg-web b/test/hg-web
new file mode 100755
index 0000000..b70dfe0
--- /dev/null
+++ b/test/hg-web
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+# Copyright 2017 Bob Proulx <bob@proulx.com>
+# You may freely use, modify and/or distribute this file.
+
+# Ensure a standard behavior regardless of caller locale setting.
+export LC_ALL=C
+
+unset tmpdir
+cleanup() {
+ test -n "$tmpdir" && rm -rf "$tmpdir" && unset tmpdir
+}
+trap "cleanup" EXIT
+trap "cleanup; trap - HUP; kill -HUP $$" HUP
+trap "cleanup; trap - INT; kill -INT $$" INT
+trap "cleanup; trap - QUIT; kill -QUIT $$" QUIT
+trap "cleanup; trap - TERM; kill -TERM $$" TERM
+
+tmpdir=$(mktemp -d -t "sv-test.XXXXXXXX") || exit 1
+
+cd "$tmpdir" || exit 1
+
+testit() {
+ url=$1 ; shift
+ wget -Oout "$url"
+ if [ $? -ne 0 ]; then
+ echo "Failed to web GET: $url"
+ exit 1
+ fi
+ test -s out || exit 1
+ rm -f out
+ test -s out && exit 1
+}
+
+testitxfail() {
+ url=$1 ; shift
+ wget -Oout "$url"
+ if [ $? -eq 0 ]; then
+ echo "Worked to web GET: $url"
+ exit 1
+ fi
+ test -s out && exit 1
+ echo "XFAIL: $url"
+}
+
+HGPROJ=${HGPROJ:-test-project}
+
+list="
+//hg.savannah.gnu.org/hgweb/${HGPROJ}/
+//hg.savannah.nongnu.org/hgweb/${HGPROJ}/
+//hg.sv.gnu.org/hgweb/${HGPROJ}/
+//hg.sv.nongnu.org/hgweb/${HGPROJ}/
+"
+for url in $list; do
+ testit "https:$url"
+done
+for url in $list; do
+ testit "http:$url"
+done
+
+testrobots() {
+ url=$1 ; shift
+ wget -Oout "$url"
+ fail=false
+ if [ $? -ne 0 ]; then
+ echo "Failed to web GET: $url"
+ fail=true
+ fi
+ test -s out || fail=true
+ grep ^User-agent: out || fail=true
+ grep ^Disallow: out || fail=true
+ rm -f out
+ test -s out && fail=true
+ $fail && exit 1
+}
+
+testrobots https://hg.savannah.gnu.org/robots.txt
+testrobots https://hg.savannah.nongnu.org/robots.txt
+
+testrobots https://hg.sv.gnu.org/robots.txt
+testrobots https://hg.sv.nongnu.org/robots.txt
+
+testrobots http://hg.savannah.gnu.org/robots.txt
+testrobots http://hg.savannah.nongnu.org/robots.txt
+
+testrobots http://hg.sv.gnu.org/robots.txt
+testrobots http://hg.sv.nongnu.org/robots.txt
+
+exit 0