summaryrefslogtreecommitdiffstats
path: root/debian/tests/multiple-pkgs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 04:42:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 04:42:34 +0000
commitc5efd282371d5b199d2d96c13ea3334a42161dfb (patch)
treefb8f55cadae3b93ef210a1be5237a7834362e6d4 /debian/tests/multiple-pkgs
parentAdding upstream version 1.7. (diff)
downloaddh-nss-c5efd282371d5b199d2d96c13ea3334a42161dfb.tar.xz
dh-nss-c5efd282371d5b199d2d96c13ea3334a42161dfb.zip
Adding debian version 1.7.debian/1.7debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xdebian/tests/multiple-pkgs60
1 files changed, 60 insertions, 0 deletions
diff --git a/debian/tests/multiple-pkgs b/debian/tests/multiple-pkgs
new file mode 100755
index 0000000..57ecab7
--- /dev/null
+++ b/debian/tests/multiple-pkgs
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+set -eu
+
+. "$(dirname "$0")/shared-functions.sh"
+
+testname1="$(basename "$0")-a"
+testname2="$(basename "$0")-b"
+pkgname1="libnss-test-$testname1"
+pkgname2="libnss-test-$testname2"
+
+nss_lines1="
+hosts first mynss_a1
+hosts last mynss_a2 [NOTFOUND=return]"
+
+nss_lines2="
+hosts after=mynss_a2 mynss_b1
+hosts before=dns mynss_b2"
+
+
+expected_services_initial="files dns"
+expected_services_after_inst1="mynss_a1 files dns mynss_a2 [NOTFOUND=return]"
+expected_services_after_inst2="mynss_a1 files mynss_b2 dns mynss_a2 [NOTFOUND=return] mynss_b1"
+expected_services_after_rm1="files mynss_b2 dns mynss_b1"
+expected_services_after_rm2="$expected_services_initial"
+
+echo "Set up and build test packages..."
+cd "$AUTOPKGTEST_TMP"
+mkdir "$pkgname1"
+cd "$pkgname1"
+setup_pkg "$pkgname1" "$testname1"
+build_pkg "$pkgname1" "1.1" "$nss_lines1"
+
+cd "$AUTOPKGTEST_TMP"
+mkdir "$pkgname2"
+cd "$pkgname2"
+setup_pkg "$pkgname2" "$testname2"
+build_pkg "$pkgname2" "2.2" "$nss_lines2"
+
+cd "$AUTOPKGTEST_TMP"
+
+echo "Set up /etc/nsswitch.conf..."
+echo "$NSSWITCH_CONF" > /etc/nsswitch.conf
+check_line "hosts" "$expected_services_initial"
+
+echo "Test that installing package A installs the services..."
+dpkg --install "${pkgname1}_1.1_all.deb"
+check_line "hosts" "$expected_services_after_inst1"
+
+echo "Test that installing package B installs the other services..."
+dpkg --install "${pkgname2}_2.2_all.deb"
+check_line "hosts" "$expected_services_after_inst2"
+
+echo "Test that removing package A removes its services..."
+dpkg --remove "$pkgname1"
+check_line "hosts" "$expected_services_after_rm1"
+
+echo "Test that removing package B removes its services..."
+dpkg --remove "$pkgname2"
+check_line "hosts" "$expected_services_after_rm2"