summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2019-08-21 17:48:03 +0100
committerBen Hutchings <ben@decadent.org.uk>2019-08-21 18:12:10 +0100
commit116ce5c6bd17291f2e2e8fd3efc6a0660223953e (patch)
tree2feffdea9294de9bcb46eba99c9436fc927d2424 /debian
parent953d80c516d0552405058329d1ced6e22c848a81 (diff)
autopkgtest: Only test hook and boot scripts from specific packages
There are still other packages with hooks and scripts that shellcheck finds fault with. This shouldn't cause a test failure for initramfs-tools itself, but unfortunately that's what happens now: https://ci.debian.net/data/autopkgtest/testing/amd64/i/initramfs-tools/2780481/log.gz Replace the Test-Command with a script that tests only hook and boot scripts installed by specific binary packages. We can expand this list as and when other packages are updated. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'debian')
-rw-r--r--debian/tests/control2
-rwxr-xr-xdebian/tests/shellcheck25
2 files changed, 26 insertions, 1 deletions
diff --git a/debian/tests/control b/debian/tests/control
index 2845c35..ab19b6c 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,2 +1,2 @@
-Test-Command: shellcheck -e SC1090,SC1091 -s dash /usr/bin/lsinitramfs /usr/sbin/mkinitramfs /usr/bin/unmkinitramfs /usr/share/initramfs-tools/hook-functions /usr/share/initramfs-tools/init /etc/kernel/postinst.d/initramfs-tools /etc/kernel/postrm.d/initramfs-tools /usr/sbin/update-initramfs $(find /usr/share/initramfs-tools/hooks /usr/share/initramfs-tools/scripts -type f)
+Tests: shellcheck
Depends: @, shellcheck
diff --git a/debian/tests/shellcheck b/debian/tests/shellcheck
new file mode 100755
index 0000000..37765a2
--- /dev/null
+++ b/debian/tests/shellcheck
@@ -0,0 +1,25 @@
+#!/bin/sh -eu
+
+export LC_COLLATE=C.UTF-8
+unset LC_ALL
+
+# The packages that install hook/boot scripts
+dpkg -S /usr/share/initramfs-tools/hooks /usr/share/initramfs-tools/scripts \
+ | sed 's/: .*//; s/, /\n/g' \
+ | sort -u \
+ > "$AUTOPKGTEST_TMP/installed-packages"
+
+# The packages that we're prepared to test
+echo "initramfs-tools initramfs-tools-core klibc-utils kmod udev" \
+ | sed 's/ /\n/g' \
+ | sort -u \
+ > "$AUTOPKGTEST_TMP/tested-packages"
+
+# Installed hook/boot scripts that we're prepared to test
+join "$AUTOPKGTEST_TMP/installed-packages" "$AUTOPKGTEST_TMP/tested-packages" \
+ | xargs dpkg -L \
+ | grep -E '^/usr/share/initramfs-tools/(hooks|scripts)/' \
+ | while read file; do test -f "$file" && printf '%s\n' "$file"; done \
+ > "$AUTOPKGTEST_TMP/hook-boot-scripts"
+
+shellcheck -e SC1090,SC1091 -s dash /usr/bin/lsinitramfs /usr/sbin/mkinitramfs /usr/bin/unmkinitramfs /usr/share/initramfs-tools/hook-functions /usr/share/initramfs-tools/init /etc/kernel/postinst.d/initramfs-tools /etc/kernel/postrm.d/initramfs-tools /usr/sbin/update-initramfs $(cat "$AUTOPKGTEST_TMP/hook-boot-scripts")