summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2013-06-04 17:18:25 +0000
committerXavier Roche <xroche@users.noreply.github.com>2013-06-04 17:18:25 +0000
commit142a8e255a3f6b25793fe34cd2b91ac3600735fd (patch)
tree8c94deabb862c929f5041c238fdb487ce4f0e281 /tests
parentda40771dee246bd6649d07cf0247e5547e022097 (diff)
Do not execute tests unless external network is available.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/10_crawl-simple.test2
-rwxr-xr-xtests/11_crawl-idna.test2
-rwxr-xr-xtests/11_crawl-international.test2
-rwxr-xr-xtests/11_crawl-parsing.test2
-rw-r--r--tests/Makefile.am3
-rwxr-xr-xtests/check-network.sh29
6 files changed, 39 insertions, 1 deletions
diff --git a/tests/10_crawl-simple.test b/tests/10_crawl-simple.test
index a05364b..c6910d8 100755
--- a/tests/10_crawl-simple.test
+++ b/tests/10_crawl-simple.test
@@ -1,4 +1,6 @@
#!/bin/bash
#
+bash check-network.sh || ! echo "no network; skipping" || exit 77
+
bash crawl-test.sh --errors 0 --files 5 httrack http://ut.httrack.com/simple/basic.html
diff --git a/tests/11_crawl-idna.test b/tests/11_crawl-idna.test
index 6866d80..ba9aa6b 100755
--- a/tests/11_crawl-idna.test
+++ b/tests/11_crawl-idna.test
@@ -1,6 +1,8 @@
#!/bin/bash
#
+bash check-network.sh || ! echo "no network; skipping" || exit 77
+
# unicode tests
bash crawl-test.sh \
--errors 1 --files 5 \
diff --git a/tests/11_crawl-international.test b/tests/11_crawl-international.test
index cc5f627..e91b87a 100755
--- a/tests/11_crawl-international.test
+++ b/tests/11_crawl-international.test
@@ -1,6 +1,8 @@
#!/bin/bash
#
+bash check-network.sh || ! echo "no network; skipping" || exit 77
+
# unicode tests
bash crawl-test.sh \
--errors 1 --files 10 \
diff --git a/tests/11_crawl-parsing.test b/tests/11_crawl-parsing.test
index 6fb5da4..c80cbb8 100755
--- a/tests/11_crawl-parsing.test
+++ b/tests/11_crawl-parsing.test
@@ -1,6 +1,8 @@
#!/bin/bash
#
+bash check-network.sh || ! echo "no network; skipping" || exit 77
+
# http://code.google.com/p/httrack/issues/detail?id=4&can=1
bash crawl-test.sh --errors 0 --files 4 \
--found ut.httrack.com/parsing/back5e1f.gif \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5a076f6..8aefe73 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,4 +4,5 @@ TESTS_ENVIRONMENT =
TESTS_ENVIRONMENT += $(SHLIBPATH_VAR)="$(top_builddir)/src/$(LT_CV_OBJDIR)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)"
TESTS_ENVIRONMENT += PATH=$(top_builddir)/src/$(LT_CV_OBJDIR):$$PATH
-TESTS = *.test
+TEST_EXTENSIONS = .test
+TESTS = 00_runnable.test 01_engine-charset.test 01_engine-entities.test 01_engine-idna.test 01_engine-simplify.test 10_crawl-simple.test 11_crawl-idna.test 11_crawl-international.test 11_crawl-parsing.test
diff --git a/tests/check-network.sh b/tests/check-network.sh
new file mode 100755
index 0000000..85c96ea
--- /dev/null
+++ b/tests/check-network.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+#
+
+# ensure the httrack unit tests are available so that ut will not break
+# the build in case of network outage
+
+# test url
+url=http://ut.httrack.com/enabled
+
+# cache file name
+cache=check-network_sh.cache
+
+# cached result ?
+if test -f $cache ; then
+ if grep -q "ok" $cache ; then
+ exit 0
+ else
+ exit 1
+ fi
+fi
+
+# fetch single file
+if bash crawl-test.sh --errors 0 --files 1 --summary httrack --timeout=3 --max-time=3 "$url" 2>/dev/null >/dev/null ; then
+ echo "ok" > $cache
+ exit 0
+else
+ echo "error" > $cache
+ exit 1
+fi