summaryrefslogtreecommitdiff
path: root/tests/check-network.sh
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/check-network.sh
parentda40771dee246bd6649d07cf0247e5547e022097 (diff)
Do not execute tests unless external network is available.
Diffstat (limited to 'tests/check-network.sh')
-rwxr-xr-xtests/check-network.sh29
1 files changed, 29 insertions, 0 deletions
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