diff options
Diffstat (limited to 'debian/tests')
-rw-r--r-- | debian/tests/common | 17 | ||||
-rw-r--r-- | debian/tests/control | 7 | ||||
-rw-r--r-- | debian/tests/testsuite-live | 17 | ||||
-rw-r--r-- | debian/tests/testsuite-live-python2 | 8 | ||||
-rw-r--r-- | debian/tests/testsuite-live-python3 | 13 |
5 files changed, 62 insertions, 0 deletions
diff --git a/debian/tests/common b/debian/tests/common new file mode 100644 index 0000000..f9562b3 --- /dev/null +++ b/debian/tests/common @@ -0,0 +1,17 @@ +if ! grep -q -E '^Seccomp:[[:blank:]]+0$' /proc/self/status; then + echo "Skipping autpkgptest as the test environment already applies a seccomp filter" + exit 77 +fi + +SRCDIR="$(pwd)" + +mkdir "$AUTOPKGTEST_TMP/tests" "$AUTOPKGTEST_TMP/tools" +cp -a tests/. "$AUTOPKGTEST_TMP/tests/" + +cd "$AUTOPKGTEST_TMP/tests" + +# build tools needed for tests +for tool in scmp_api_level scmp_arch_detect scmp_sys_resolver; do + echo "Building $tool ..." + gcc -O2 -g "$SRCDIR/tools/$tool.c" "$SRCDIR/tools/util.c" -lseccomp -o ../tools/$tool +done diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..75c3379 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,7 @@ +Tests: testsuite-live +Depends: libseccomp-dev, build-essential +Restrictions: skippable + +Tests: testsuite-live-python3 +Depends: libseccomp-dev, build-essential, python3-seccomp +Restrictions: skippable, allow-stderr diff --git a/debian/tests/testsuite-live b/debian/tests/testsuite-live new file mode 100644 index 0000000..bbf20d0 --- /dev/null +++ b/debian/tests/testsuite-live @@ -0,0 +1,17 @@ +#!/bin/sh + +set -eu + +. debian/tests/common + +# manually build necessary files against the installed libseccomp + +# build live tests +for filename in *-live-*.tests; do + testname=$(echo "$filename" | cut -f 1 -d '.') + echo "Building $testname ..." + gcc -O2 -g "${testname}.c" util.c -pthread -lseccomp -o "$testname" +done + +echo "Running test suite ..." +./regression -T live diff --git a/debian/tests/testsuite-live-python2 b/debian/tests/testsuite-live-python2 new file mode 100644 index 0000000..9c9ded4 --- /dev/null +++ b/debian/tests/testsuite-live-python2 @@ -0,0 +1,8 @@ +#!/bin/sh + +set -eu + +. debian/tests/common + +echo "Running test suite ..." +./regression -T live -m python diff --git a/debian/tests/testsuite-live-python3 b/debian/tests/testsuite-live-python3 new file mode 100644 index 0000000..f4fb094 --- /dev/null +++ b/debian/tests/testsuite-live-python3 @@ -0,0 +1,13 @@ +#!/bin/sh + +set -eu + +. debian/tests/common + +# make sure "python" points to python3 as this is not configurable +# in the regression script +mkdir python3env +ln -s /usr/bin/python3 python3env/python + +echo "Running test suite ..." +PATH="$(pwd)/python3env:$PATH" ./regression -T live -m python |