summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2022-04-20 18:42:12 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2022-05-07 10:45:44 +0200
commita48a432223e9feb3e70b6d7dee09d035f594eeed (patch)
tree288d396d34d91fc2498e1f459390769b78fb738c
parent065c17440bd030341d7729c626dc732eff48ff7e (diff)
Mark pkg-config-test autopkgtest as superficial
Reorganising the control file allows this simple test to run first and be marked as superficial which makes no practical difference, but is more correct.
-rw-r--r--debian/tests/control13
-rw-r--r--debian/tests/pkg-config-test31
2 files changed, 27 insertions, 17 deletions
diff --git a/debian/tests/control b/debian/tests/control
index 446f0afcc..e273b737f 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,10 +1,11 @@
-Tests: run-tests, pkg-config-test
+Tests: pkg-config-test
+Restrictions: superficial
+Depends: libapt-pkg-dev, pkg-config
+
+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),
+ gnupg (>= 2) | gnupg2, gnupg1 | gnupg (<< 2),
+ gpgv (>= 2) | gpgv2, gpgv1 | gpgv (<< 2),
libfile-fcntllock-perl, python3-apt, aptitude,
- pkg-config,
valgrind, gdb-minimal | gdb
diff --git a/debian/tests/pkg-config-test b/debian/tests/pkg-config-test
index 1e4ec141e..e074b1603 100644
--- a/debian/tests/pkg-config-test
+++ b/debian/tests/pkg-config-test
@@ -1,23 +1,32 @@
#!/bin/sh
-
set -e
-WORKDIR=$(mktemp -d)
-trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
-cd $WORKDIR
-cat <<EOF > pkgconfigtest.c
+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 <stdio.h>
+#include <cstdio>
int main()
{
- printf("Apt Version: %s \n", pkgVersion);
+ printf("APT Version: %s\n", pkgVersion);
return 0;
}
EOF
-g++ -o pkgconfigtest pkgconfigtest.c `pkg-config --cflags --libs apt-pkg`
-echo "build: OK"
-[ -x pkgconfigtest ]
+g++ -Wall -Wextra -o pkgconfigtest pkgconfigtest.cc `pkg-config --cflags --libs apt-pkg`
+echo 'build: OK'
+test -x pkgconfigtest
./pkgconfigtest
-echo "run: OK"
+echo 'run: OK'