summaryrefslogtreecommitdiffstats
path: root/debian/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:30:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:30:57 +0000
commitee91363e6620c0bdc9dcb31c02266905fca09b49 (patch)
treea2d7872eef98e1e124d65eb7789d8de07da1cc82 /debian/tests
parentAdding upstream version 1:3.11.1. (diff)
downloadpciutils-ee91363e6620c0bdc9dcb31c02266905fca09b49.tar.xz
pciutils-ee91363e6620c0bdc9dcb31c02266905fca09b49.zip
Adding debian version 1:3.11.1-1.debian/1%3.11.1-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests')
-rw-r--r--debian/tests/control9
-rwxr-xr-xdebian/tests/test-libpci39
2 files changed, 48 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..f836fa7
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,9 @@
+Tests:
+ test-libpci
+Restrictions:
+ allow-stderr
+ superficial
+Depends:
+ build-essential,
+ libpci-dev,
+ pkgconf,
diff --git a/debian/tests/test-libpci b/debian/tests/test-libpci
new file mode 100755
index 0000000..1951e66
--- /dev/null
+++ b/debian/tests/test-libpci
@@ -0,0 +1,39 @@
+#!/bin/sh
+# Copyright © 2020 Collabora Ltd.
+# Copyright © 2020 Guillem Jover <guillem@debian.org>
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+set -e
+set -u
+set -x
+
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+ CC="$DEB_HOST_GNU_TYPE-gcc"
+ PKG_CONFIG="$DEB_HOST_GNU_TYPE-pkg-config"
+else
+ CC=gcc
+ PKG_CONFIG=pkg-config
+fi
+
+CFLAGS="-Wall -g -O2 -D_GNU_SOURCE"
+LIBS=$($PKG_CONFIG --cflags --libs libpci)
+
+cd "$AUTOPKGTEST_TMP"
+
+cat <<EOF >test-libpci.c
+#include <pci/pci.h>
+
+int main(void)
+{
+ struct pci_access *a;
+ a = pci_alloc();
+ pci_init(a);
+ pci_cleanup(a);
+ return 0;
+}
+EOF
+
+# Test building minimal code against the installed library.
+$CC $CFLAGS -o test-dynamic test-libpci.c $LIBS
+test -x ./test-dynamic
+./test-dynamic