summaryrefslogtreecommitdiffstats
path: root/debian/tests
diff options
context:
space:
mode:
Diffstat (limited to 'debian/tests')
-rw-r--r--debian/tests/control11
-rw-r--r--debian/tests/pkg-config-test32
-rw-r--r--debian/tests/run-tests37
3 files changed, 80 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..d2b2e32
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,11 @@
+Tests: pkg-config-test
+Restrictions: superficial
+Depends: libapt-pkg-dev, pkg-config, g++
+
+Tests: run-tests
+Restrictions: allow-stderr
+Depends: @, @builddeps@, dpkg (>= 1.20.8), fakeroot, wget, stunnel4, lsof, db-util,
+ gnupg (>= 2) | gnupg2, gnupg1 | gnupg (<< 2),
+ gpgv (>= 2) | gpgv2, gpgv1 | gpgv (<< 2),
+ libfile-fcntllock-perl, python3-apt, aptitude,
+ valgrind, gdb-minimal | gdb
diff --git a/debian/tests/pkg-config-test b/debian/tests/pkg-config-test
new file mode 100644
index 0000000..e074b16
--- /dev/null
+++ b/debian/tests/pkg-config-test
@@ -0,0 +1,32 @@
+#!/bin/sh
+set -e
+
+if [ -z "$AUTOPKGTEST_TMP" ]; then
+ WORKDIR=''
+ cleanup() {
+ if [ -n "$WORKDIR" ]; then cd /; rm -rf -- "$WORKDIR"; fi
+ WORKDIR=''
+ }
+ trap 'cleanup' 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+ WORKDIR="$(mktemp -d)"
+ cd "$WORKDIR"
+else
+ cd "$AUTOPKGTEST_TMP"
+fi
+
+cat >pkgconfigtest.cc <<EOF
+#include <apt-pkg/init.h>
+#include <cstdio>
+
+int main()
+{
+ printf("APT Version: %s\n", pkgVersion);
+ return 0;
+}
+EOF
+
+g++ -Wall -Wextra -o pkgconfigtest pkgconfigtest.cc `pkg-config --cflags --libs apt-pkg`
+echo 'build: OK'
+test -x pkgconfigtest
+./pkgconfigtest
+echo 'run: OK'
diff --git a/debian/tests/run-tests b/debian/tests/run-tests
new file mode 100644
index 0000000..c7ca16b
--- /dev/null
+++ b/debian/tests/run-tests
@@ -0,0 +1,37 @@
+#!/bin/sh
+set -e
+
+SOURCE_DIR="$(pwd)"
+if [ -z "$AUTOPKGTEST_TMP" ]; then
+ BUILD_DIR=''
+ cleanup() {
+ if [ -n "$BUILD_DIR" ]; then cd /; rm -rf -- "$BUILD_DIR"; fi
+ BUILD_DIR=''
+ }
+ trap 'cleanup' 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+ BUILD_DIR="$(mktemp -d)"
+else
+ BUILD_DIR="$AUTOPKGTEST_TMP"
+fi
+
+if [ ! -e "${BUILD_DIR}/CMakeCache.txt" ]; then
+ cmake -S "$SOURCE_DIR" -B "$BUILD_DIR" -DUSE_SYSTEM_APTPKG=ON -DWITH_DOC=OFF -DUSE_NLS=OFF
+fi
+
+make -C "${BUILD_DIR}/test/interactive-helper"
+
+# run tests against the installed apt, use "env -i" to ensure
+# the host env does not pollute our environment
+env -i \
+APT_INTEGRATION_TESTS_SOURCE_DIR="${SOURCE_DIR}" \
+APT_INTEGRATION_TESTS_BUILD_DIR="${BUILD_DIR}" \
+APT_INTEGRATION_TESTS_METHODS_DIR=/usr/lib/apt/methods \
+APT_INTEGRATION_TESTS_LIBEXEC_DIR=/usr/lib/apt/ \
+APT_INTEGRATION_TESTS_INTERNAL_SOLVER=/usr/lib/apt/solvers/apt \
+APT_INTEGRATION_TESTS_DUMP_SOLVER=/usr/lib/apt/solvers/dump \
+APT_INTEGRATION_TESTS_INTERNAL_PLANNER=/usr/lib/apt/planners/apt \
+APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR=/usr/bin \
+APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR=/usr/bin \
+APT_INTEGRATION_TESTS_LIBRARY_PATH=/dev/null/does/not/exist \
+APT_INTEGRATION_TESTS_ARTIFACTS_DIR="${AUTOPKGTEST_ARTIFACTS}" \
+"${SOURCE_DIR}/test/integration/run-tests" -q