[Pkg-swan-devel] [strongswan] 05/11: * Add basic DEP8 tests
Yves-Alexis Perez
corsac at moszumanska.debian.org
Mon Jan 16 13:55:43 UTC 2017
This is an automated email from the git hooks/post-receive script.
corsac pushed a commit to branch master
in repository strongswan.
commit 58adc44ebf6bd30dabd5f61299be79e4270d3b1a
Author: Christian Ehrhardt <christian.ehrhardt at canonical.com>
Date: Thu Nov 3 15:03:59 2016 +0100
* Add basic DEP8 tests
- d/tests/* add DEP8 tests
- d/control enable autotestpkg
Signed-off-by: Christian Ehrhardt <christian.ehrhardt at canonical.com>
---
debian/control | 1 +
debian/tests/admin-strongswan-charon | 17 +++++++++++++++++
debian/tests/admin-strongswan-starter | 21 +++++++++++++++++++++
debian/tests/control | 3 +++
debian/tests/daemon | 14 ++++++++++++++
debian/tests/plugins | 28 ++++++++++++++++++++++++++++
6 files changed, 84 insertions(+)
diff --git a/debian/control b/debian/control
index b169bad..391d615 100644
--- a/debian/control
+++ b/debian/control
@@ -38,6 +38,7 @@ Build-Depends: bison,
systemd [linux-any],
tzdata
Homepage: http://www.strongswan.org
+XS-Testsuite: autopkgtest
Package: strongswan
Architecture: all
diff --git a/debian/tests/admin-strongswan-charon b/debian/tests/admin-strongswan-charon
new file mode 100755
index 0000000..e9b57bd
--- /dev/null
+++ b/debian/tests/admin-strongswan-charon
@@ -0,0 +1,17 @@
+#!/bin/sh
+#--------------------------
+# Testing strongswan-charon
+#--------------------------
+CMDS="
+/usr/lib/ipsec/charon
+"
+
+for cmd in $CMDS; do
+ $cmd --help > /dev/null 2>&1
+ RET=$?
+
+ if [ $RET -ne 0 ]; then
+ echo "ERROR, failed to run ${cmd}" >&2
+ exit $RET
+ fi
+done
diff --git a/debian/tests/admin-strongswan-starter b/debian/tests/admin-strongswan-starter
new file mode 100755
index 0000000..7b32e00
--- /dev/null
+++ b/debian/tests/admin-strongswan-starter
@@ -0,0 +1,21 @@
+#!/bin/sh
+#---------------------------
+# Testing strongswan-starter
+#---------------------------
+CMDS="
+/usr/bin/pki
+/usr/lib/ipsec/_copyright
+/usr/lib/ipsec/scepclient
+/usr/lib/ipsec/stroke
+/usr/sbin/ipsec
+"
+
+for cmd in $CMDS; do
+ $cmd --help > /dev/null 2>&1
+ RET=$?
+
+ if [ $RET -ne 0 ]; then
+ echo "ERROR, failed to run ${cmd}" >&2
+ exit $RET
+ fi
+done
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..eb9e204
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,3 @@
+Tests: daemon admin-strongswan-charon admin-strongswan-starter plugins
+Depends: strongswan, libstrongswan-standard-plugins, libstrongswan-extra-plugins, libcharon-extra-plugins, strongswan-pki, strongswan-scepclient
+Restrictions: needs-root isolation-container allow-stderr
diff --git a/debian/tests/daemon b/debian/tests/daemon
new file mode 100755
index 0000000..2a8b5e6
--- /dev/null
+++ b/debian/tests/daemon
@@ -0,0 +1,14 @@
+#!/bin/sh
+#------------------------
+# Testing starter, charon
+#------------------------
+DAEMONS="starter charon"
+
+for daemon in $DAEMONS; do
+ if pidof -x $daemon > /dev/null; then
+ echo "$daemon OK"
+ else
+ echo "ERROR: ${daemon} IS NOT RUNNING"
+ exit 1
+ fi
+done
diff --git a/debian/tests/plugins b/debian/tests/plugins
new file mode 100644
index 0000000..24825c8
--- /dev/null
+++ b/debian/tests/plugins
@@ -0,0 +1,28 @@
+#!/bin/bash
+# find the set of plugins from default installed libraries
+# and compare that with what ipsec has loaded.
+
+# restart strongswan to get current list of loaded modules
+invoke-rc.d strongswan restart
+invoke-rc.d strongswan status
+
+STRONGSWAN_PKGS="$(dpkg --list | awk '/(strongswan|charon)/ {print $2}')"
+PLUGIN_PATH="/usr/lib/ipsec/plugins/"
+EXPECTED_MODULES="charon"
+for pkg in $STRONGSWAN_PKGS; do
+ P=$(dpkg -L $pkg | grep "^${PLUGIN_PATH}" |
+ sed -e "s,${PLUGIN_PATH}libstrongswan-,,g" -e 's,.so$,,')
+ EXPECTED_MODULES="${EXPECTED_MODULES} ${P}"
+done
+# expected to not load; they require configuration
+# NB: keep leading/trailing space for regex generation
+NOLOAD=" attr-sql coupling eap-simaka-sql eap-sim-file kernel-libipsec load-tester medcli medsrv sql systime-fix "
+# rdrand is dynamically detected
+MAYBELOAD="rdrand "
+NOLOADR="(`echo "${NOLOAD}${MAYBELOAD}" | sed 's, ,$|^,g'`)"
+MAYBELOADR="(`echo " ${MAYBELOAD}" | sed 's, ,$|^,g'`)"
+EXPECTED=( `echo $EXPECTED_MODULES | fmt -w1 | egrep -v "$NOLOADR"` )
+LOADED=( `ipsec listplugins | grep :$ | grep -v "Plugin" | egrep -v "$MAYBELOADR" | sed 's,:,,g'` )
+
+diff <(printf "%s\n" "${EXPECTED[@]}"|sort) <(printf "%s\n" "${LOADED[@]}"|sort)
+exit $?
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-swan/strongswan.git
More information about the Pkg-swan-devel
mailing list