summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Proulx <bob@proulx.com>2017-01-09 01:55:50 (GMT)
committerBob Proulx <bob@proulx.com>2017-01-09 01:55:50 (GMT)
commitcf4044c5e55b7ef19b129fd8ee6c18175f4fbf1b (patch)
tree2e9a6b6b4fca274daa9e352cd5e25c4bee75dccf
parent37ed9d4fb9ecd766c61485329c31b4cd1de895da (diff)
downloadsavannah-tests-cf4044c5e55b7ef19b129fd8ee6c18175f4fbf1b.zip
savannah-tests-cf4044c5e55b7ef19b129fd8ee6c18175f4fbf1b.tar.gz
savannah-tests-cf4044c5e55b7ef19b129fd8ee6c18175f4fbf1b.tar.bz2
Add git tests.
-rw-r--r--test/Makefile.am5
-rwxr-xr-xtest/git-git56
-rwxr-xr-xtest/git-http59
-rwxr-xr-xtest/git-https59
-rwxr-xr-xtest/git-rsync39
-rwxr-xr-xtest/git-ssh68
6 files changed, 284 insertions, 2 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index b3e7cf6..ec4f53c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,6 +1,7 @@
TESTS = \
- bzr-bzr bzr-ssh bzr-web bzr-web-xfail bzr-rsync
+ bzr-bzr bzr-ssh bzr-web bzr-web-xfail bzr-rsync \
+ git-git git-ssh git-http git-https git-rsync
-XFAIL_TESTS = bzr-web-xfail
+XFAIL_TESTS = bzr-web-xfail git-https
EXTRA_DIST = $(TESTS)
diff --git a/test/git-git b/test/git-git
new file mode 100755
index 0000000..cbe091d
--- /dev/null
+++ b/test/git-git
@@ -0,0 +1,56 @@
+#!/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
+# Begin dash specific trap handling.
+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
+# End dash specific trap handling.
+
+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
+ git clone $args "$url"
+ if [ $? -ne 0 ]; then
+ echo "Failed to git clone $args $url"
+ exit 1
+ fi
+ base=$(basename "$url" .git)
+ test -d "$base" || exit 1
+ rm -rf "$base"
+ test -d "$base" && exit 1
+}
+
+list="
+git://git.sv.gnu.org/hello.git
+git://git.savannah.gnu.org/hello.git
+git://git.sv.nongnu.org/hello.git
+git://git.savannah.nongnu.org/hello.git
+"
+for url in $list; do
+ testit "$url" "--depth 1"
+done
+# If --depth 1 works then we don't need to test without it.
+# Since it can be a relatively expensive test.
+# for url in $list1; do
+# testit "$url"
+# done
+
+exit 0
diff --git a/test/git-http b/test/git-http
new file mode 100755
index 0000000..8af5a7f
--- /dev/null
+++ b/test/git-http
@@ -0,0 +1,59 @@
+#!/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
+# Begin dash specific trap handling.
+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
+# End dash specific trap handling.
+
+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"
+}
+
+list="
+//git.savannah.gnu.org/
+//git.savannah.gnu.org/robots.txt
+//git.savannah.gnu.org/cgit/
+//git.savannah.gnu.org/gitweb/
+//git.savannah.gnu.org/r/
+"
+for url in $list; do
+ testit "http:$url"
+done
+
+exit 0
diff --git a/test/git-https b/test/git-https
new file mode 100755
index 0000000..02e34e2
--- /dev/null
+++ b/test/git-https
@@ -0,0 +1,59 @@
+#!/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
+# Begin dash specific trap handling.
+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
+# End dash specific trap handling.
+
+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"
+}
+
+list="
+//git.savannah.gnu.org/
+//git.savannah.gnu.org/robots.txt
+//git.savannah.gnu.org/cgit/
+//git.savannah.gnu.org/gitweb/
+//git.savannah.gnu.org/r/
+"
+for url in $list; do
+ testit "https:$url"
+done
+
+exit 0
diff --git a/test/git-rsync b/test/git-rsync
new file mode 100755
index 0000000..bb5f472
--- /dev/null
+++ b/test/git-rsync
@@ -0,0 +1,39 @@
+#!/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
+# Begin dash specific trap handling.
+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
+# End dash specific trap handling.
+
+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
+}
+
+testit rsync://svn.sv.gnu.org/git/administration/
+
+exit 0
diff --git a/test/git-ssh b/test/git-ssh
new file mode 100755
index 0000000..b4d2736
--- /dev/null
+++ b/test/git-ssh
@@ -0,0 +1,68 @@
+#!/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
+# Begin dash specific trap handling.
+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
+# End dash specific trap handling.
+
+tmpdir=$(mktemp -d -t "sv-test.XXXXXXXX") || exit 1
+
+cd "$tmpdir" || exit 1
+
+HOME=$tmpdir
+mkdir "$tmpdir/.ssh"
+cat > "$tmpdir/.ssh/config" <<EOF
+Host *
+ ServerAliveInterval 200
+ HashKnownHosts no
+ CheckHostIP no
+ StrictHostKeyChecking no
+ UserKnownHostsFile /dev/null
+ BatchMode yes
+EOF
+
+testit() {
+ url=$1 ; shift
+ if [ $# -ge 1 ]; then
+ args=$1 ; shift
+ fi
+ git clone $args "$url"
+ if [ $? -ne 0 ]; then
+ echo "Failed to git clone $args $url"
+ exit 1
+ fi
+ base=$(basename "$url" .git)
+ test -d "$base" || exit 1
+ rm -rf "$base"
+ test -d "$base" && exit 1
+}
+
+list="
+ssh://$USER@git.sv.gnu.org/srv/git/hello.git
+ssh://$USER@git.savannah.gnu.org/srv/git/hello.git
+ssh://$USER@git.sv.nongnu.org/srv/git/hello.git
+ssh://$USER@git.savannah.nongnu.org/srv/git/hello.git
+"
+for url in $list; do
+ testit "$url" "--depth 1"
+done
+# If --depth 1 works then we don't need to test without it.
+# Since it can be a relatively expensive test.
+# for url in $list1; do
+# testit "$url"
+# done
+
+exit 0