summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Proulx <bob@proulx.com>2017-01-09 01:55:07 (GMT)
committerBob Proulx <bob@proulx.com>2017-01-09 01:55:07 (GMT)
commit37ed9d4fb9ecd766c61485329c31b4cd1de895da (patch)
treeac39733af36833b8c34bdcc4a3dcb35be2f913e9
parent853374ef555c4480c2d1ab1c957b6273cd7f2ec9 (diff)
downloadsavannah-tests-37ed9d4fb9ecd766c61485329c31b4cd1de895da.zip
savannah-tests-37ed9d4fb9ecd766c61485329c31b4cd1de895da.tar.gz
savannah-tests-37ed9d4fb9ecd766c61485329c31b4cd1de895da.tar.bz2
Add bzr tests.
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac2
-rw-r--r--test/Makefile.am6
-rwxr-xr-xtest/bzr-bzr46
-rwxr-xr-xtest/bzr-rsync39
-rwxr-xr-xtest/bzr-ssh61
-rwxr-xr-xtest/bzr-web59
-rw-r--r--test/bzr-web-xfail51
8 files changed, 265 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 3f547cd..8f7941b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1 +1,3 @@
EXTRA_DIST = GNUmakefile
+
+SUBDIRS = test
diff --git a/configure.ac b/configure.ac
index a40979d..b00d2d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
AC_INIT([savannah-tests],[0.0])
AM_INIT_AUTOMAKE([-Wall])
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([Makefile test/Makefile])
AC_OUTPUT
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 0000000..b3e7cf6
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,6 @@
+TESTS = \
+ bzr-bzr bzr-ssh bzr-web bzr-web-xfail bzr-rsync
+
+XFAIL_TESTS = bzr-web-xfail
+
+EXTRA_DIST = $(TESTS)
diff --git a/test/bzr-bzr b/test/bzr-bzr
new file mode 100755
index 0000000..8b2d59b
--- /dev/null
+++ b/test/bzr-bzr
@@ -0,0 +1,46 @@
+#!/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
+ bzr branch -q "$url"
+ if [ $? -ne 0 ]; then
+ echo "Failed to bzr branch $url"
+ exit 1
+ fi
+ base=$(basename "$url")
+ test -d "$base" || exit 1
+ rm -rf "$base"
+ test -d "$base" && exit 1
+}
+
+list="
+bzr://bzr.savannah.gnu.org/gnewsense/docs
+bzr://bzr.savannah.nongnu.org/gnewsense/docs
+"
+for url in $list; do
+ testit "$url"
+done
+
+exit 0
diff --git a/test/bzr-rsync b/test/bzr-rsync
new file mode 100755
index 0000000..3f2366c
--- /dev/null
+++ b/test/bzr-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://bzr.sv.gnu.org/bzr/gnewsense/docs
+
+exit 0
diff --git a/test/bzr-ssh b/test/bzr-ssh
new file mode 100755
index 0000000..9e26e52
--- /dev/null
+++ b/test/bzr-ssh
@@ -0,0 +1,61 @@
+#!/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
+ bzr branch "$url"
+ if [ $? -ne 0 ]; then
+ echo "Failed to bzr branch $url"
+ exit 1
+ fi
+ base=$(basename "$url")
+ test -d "$base" || exit 1
+ rm -rf "$base"
+ test -d "$base" && exit 1
+}
+
+list="
+bzr+ssh://$USER@bzr.savannah.gnu.org/gnewsense/docs
+bzr+ssh://$USER@bzr.savannah.nongnu.org/gnewsense/docs
+"
+for url in $list; do
+ testit "$url"
+done
+
+exit 0
diff --git a/test/bzr-web b/test/bzr-web
new file mode 100755
index 0000000..a18995c
--- /dev/null
+++ b/test/bzr-web
@@ -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="
+//bzr.savannah.gnu.org/lh/gnewsense/
+//bzr.savannah.gnu.org/r/gnewsense/
+"
+for url in $list; do
+ testit "https:$url"
+done
+for url in $list; do
+ testit "http:$url"
+done
+
+exit 0
diff --git a/test/bzr-web-xfail b/test/bzr-web-xfail
new file mode 100644
index 0000000..4be5af3
--- /dev/null
+++ b/test/bzr-web-xfail
@@ -0,0 +1,51 @@
+#!/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"
+}
+
+testitxfail https://bzr.savannah.gnu.org/robots.txt
+testitxfail http://bzr.savannah.gnu.org/robots.txt
+
+exit 0