summaryrefslogtreecommitdiff
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
parent35be2c5bcf958128ed6254ed1a8b814d17c6640d (diff)
downloadsavannah-tests-833ec293858d40d7cf98d5b37c92fc642a241033.zip
savannah-tests-833ec293858d40d7cf98d5b37c92fc642a241033.tar.gz
savannah-tests-833ec293858d40d7cf98d5b37c92fc642a241033.tar.bz2
new tests: hg-{hg,rsync,ssh,web}
-rw-r--r--test/Makefile.am3
-rwxr-xr-xtest/hg-hg50
-rwxr-xr-xtest/hg-rsync42
-rwxr-xr-xtest/hg-ssh52
-rwxr-xr-xtest/hg-web89
5 files changed, 235 insertions, 1 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 02d2faf..f064071 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -2,7 +2,8 @@ TESTS = \
bzr-bzr bzr-ssh bzr-web bzr-rsync \
cvs-pserver cvs-ssh cvs-web cvs-rsync \
git-git git-ssh git-http git-https git-rsync \
- svn-svn svn-ssh svn-http svn-https svn-rsync
+ svn-svn svn-ssh svn-http svn-https svn-rsync \
+ hg-hg hg-ssh hg-web hg-rsync
XFAIL_TESTS = git-https
diff --git a/test/hg-hg b/test/hg-hg
new file mode 100755
index 0000000..afaf05f
--- /dev/null
+++ b/test/hg-hg
@@ -0,0 +1,50 @@
+#!/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
+
+ # '--insecure' needed because old 'hg' do not support SNI.
+ # see https://lists.gnu.org/archive/html/savannah-hackers-public/2017-01/msg00028.html
+ hg clone --insecure -q "$url"
+ if [ $? -ne 0 ]; then
+ echo "Failed to hg clone $url"
+ exit 1
+ fi
+ base=$(basename "$url")
+ test -d "$base" || exit 1
+ rm -rf "$base"
+ test -d "$base" && exit 1
+}
+
+HGPROJ=${HGPROJ:-test-project}
+
+for h in http https ; do
+ for s in savannah sv ; do
+ for t in gnu nongnu ; do
+ url=="$h://hg.$s.$t.org/hgweb/${HGPROJ}"
+ testit "$url"
+ done
+ done
+done
+
+exit 0
diff --git a/test/hg-rsync b/test/hg-rsync
new file mode 100755
index 0000000..24bbf98
--- /dev/null
+++ b/test/hg-rsync
@@ -0,0 +1,42 @@
+#!/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
+ rsync "$url" > out
+ if [ $? -ne 0 ]; then
+ echo "Failed: rsync $url"
+ exit 1
+ fi
+ test -s out || exit 1
+ rm -f out
+ test -s out && exit 1
+}
+
+HGPROJ=${HGPROJ:-test-project}
+
+testit rsync://hg.savannah.gnu.org/hg/${HGPROJ}
+testit rsync://hg.savannah.nongnu.org/hg/${HGPROJ}
+testit rsync://hg.sv.gnu.org/hg/${HGPROJ}
+testit rsync://hg.sv.nongnu.org/hg/${HGPROJ}
+
+exit 0
diff --git a/test/hg-ssh b/test/hg-ssh
new file mode 100755
index 0000000..27ad610
--- /dev/null
+++ b/test/hg-ssh
@@ -0,0 +1,52 @@
+#!/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
+ if [ $# -ge 1 ]; then
+ args=$1 ; shift
+ fi
+ hg clone "$url"
+ if [ $? -ne 0 ]; then
+ echo "Failed to hg clone $url"
+ exit 1
+ fi
+ base=$(basename "$url")
+ test -d "$base" || exit 1
+ rm -rf "$base"
+ test -d "$base" && exit 1
+}
+
+HGPROJ=${HGPROJ:-test-project}
+
+list="
+ssh://$USER@hg.sv.gnu.org/${HGPROJ}
+ssh://$USER@hg.sv.nongnu.org/${HGPROJ}
+ssh://$USER@hg.savannah.gnu.org/${HGPROJ}
+ssh://$USER@hg.savannah.nongnu.org/${HGPROJ}
+"
+
+for url in $list; do
+ testit "$url"
+done
+
+exit 0
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