Browse Source

Run the test suite also as an autopkgtest

Christoph Biedl 3 years ago
parent
commit
f4e7740904
2 changed files with 29 additions and 0 deletions
  1. 7 0
      debian/tests/control
  2. 22 0
      debian/tests/run-testsuite

+ 7 - 0
debian/tests/control

@@ -0,0 +1,7 @@
+Tests: run-testsuite
+Depends:
+    @,
+    curl,
+    dpkg-dev,
+    moreutils,
+    socat,

+ 22 - 0
debian/tests/run-testsuite

@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+cd tests
+
+export PATH="$PATH:/usr/libexec:/usr/lib/$(dpkg-architecture --query=DEB_HOST_GNU_TYPE 2>/dev/null)"
+
+for f in $(find . -type f -executable | sort) ; do
+    echo "I: Preparing test $f"
+    # replace socket activation with socat
+    if [ "$f" = './adv' ] ; then
+        sed -i -e 's;\$SD_ACTIVATE -l "127.0.0.1:\$PORT" -a \$VALGRIND tangd \$TMP/cache;socat TCP-LISTEN:$PORT,bind=127.0.0.1,fork "EXEC:tangd $TMP/cache";' $f
+    elif [ "$f" = './rec' ] ; then
+        sed -i -e 's;\$SD_ACTIVATE -l 127.0.0.1:\$port -a \$VALGRIND tangd \$TMP/cache;socat TCP-LISTEN:$port,bind=127.0.0.1,fork "EXEC:tangd $TMP/cache";' $f
+    fi
+    echo "I: Running test $f"
+    # test are very noisy, keep them silent as long as they pass
+    chronic "$f" || :
+done
+
+exit 0