summaryrefslogtreecommitdiff
path: root/test/hg-hg
diff options
context:
space:
mode:
Diffstat (limited to 'test/hg-hg')
-rwxr-xr-xtest/hg-hg50
1 files changed, 50 insertions, 0 deletions
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