[cip-dev] PATCH: libsemanage: Enable Autopk gtest for libsemanage
| Newsgroups | org.cip-project.lists.cip-dev |
|---|---|
| Message-ID | <TYYPR01MB1059274CE08C34D9D05AD45F9DBE82@TYYPR01MB10592.jpnprd01.prod.outlook.com> |
Source: libsemanage Version: 3.10-1 Severity: wishlist Tags: patch ftbfs Dear Maintainer, This patch enables autopkgtest for libsemanage by adding basic tests under debian/tests/ (control, upstream-tests, installed-package) to validate upstream tests and installed library usage. While doing this, APT downgrade failures were observed with the latest upstream commits and therefore skipped the following two commits: * https://salsa.debian.org/selinux-team/libsemanage/-/commit/43228664d326ce1fd83e5a3927b37a058d0a1e49 * https://salsa.debian.org/selinux-team/libsemanage/-/commit/292e2d954024845ca6048562c76221f527812fa9 The autopkgtest fails with dependency issues where apt attempts to downgrade packages: The following packages will be DOWNGRADED: libsemanage-common libsemanage2 21 upgraded, 133 newly installed, 2 downgraded, 0 to remove and 41 not upgraded. 1 not fully installed or removed. E: Packages were downgraded and -y was used without --allow-downgrades. badpkg: Test dependencies are unsatisfiable. The same commits also show build/test failures in the Debian Salsa CI, indicating possible dependency/version mismatch issues with the current test environment. Hence, autopkgtest has been enabled on a stable base excluding these commits. Request you to review and provide feedback. Kind regards, Sahithi Akunuri
0001-Add-necessary-files-to-enable-autopkgtest.patch
(application/octet-stream, 2.4 KB)
From 2b5e0b6d2444c0e848d3ce361b384fa2a1d04c47 Mon Sep 17 00:00:00 2001 From: Sahithi Akunuri <[email protected]> Date: Thu, 25 Jun 2026 16:33:41 +0530 Subject: [PATCH] Add necessary files to enable autopkgtest autopkgtest Signed-off-by: Sahithi Akunuri <[email protected]> --- debian/tests/control | 7 +++++++ debian/tests/installed-package | 35 ++++++++++++++++++++++++++++++++++ debian/tests/upstream-tests | 17 +++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 debian/tests/control create mode 100644 debian/tests/installed-package create mode 100644 debian/tests/upstream-tests diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..c7b16c3 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,7 @@ +Tests: upstream-tests +Depends: @, @builddeps@ +Restrictions: allow-stderr, build-needed + +Tests: installed-package +Depends: libsemanage-dev, gcc, pkgconf +Restrictions: allow-stderr diff --git a/debian/tests/installed-package b/debian/tests/installed-package new file mode 100644 index 0000000..0c38418 --- /dev/null +++ b/debian/tests/installed-package @@ -0,0 +1,35 @@ +#!/bin/sh + +# aborts on non-zero exit status +set -eux + +# check if libsemange is installed and available +pkg-config --exists libsemanage + +# c program to check if semanage handle is created and cleaned up +cat > test.c <<'EOF' +#include <semanage/semanage.h> + +int main(void) +{ + semanage_handle_t *h; + h = semanage_handle_create(); + if (!h) + return 1; + semanage_handle_destroy(h); + return 0; +} +EOF + +# compile using pkg-config flags +gcc test.c $(pkg-config --cflags --libs libsemanage) -o test + +# run the compiled test program +./test + +# print the execution status +if [ $? -eq 0 ]; then + echo "Success" +else + echo "Failure" +fi diff --git a/debian/tests/upstream-tests b/debian/tests/upstream-tests new file mode 100644 index 0000000..048f358 --- /dev/null +++ b/debian/tests/upstream-tests @@ -0,0 +1,17 @@ +#!/bin/bash + +# aborts on non-zero exit status +set -eux + +# find the multiarch lib directory +libdir="/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)" +echo "libdir: ${libdir}" + +# remove the library files built from source +(cd src/ && rm -f libsemanage.a) + +# copy the library files from the installed debian package +cp "${libdir}/libsemanage.a" ./src + +# run upstream tests +make -C tests test -- 2.39.5