diff options
Diffstat (limited to '')
-rw-r--r-- | tests/arm64-without-qemu-support | 2 | ||||
-rw-r--r-- | tests/i386-which-can-be-executed-without-qemu | 2 | ||||
-rw-r--r-- | tests/mmdebstrap | 2 | ||||
-rw-r--r-- | tests/zombie-reaping | 39 |
4 files changed, 42 insertions, 3 deletions
diff --git a/tests/arm64-without-qemu-support b/tests/arm64-without-qemu-support index 98b4724..77c4b20 100644 --- a/tests/arm64-without-qemu-support +++ b/tests/arm64-without-qemu-support @@ -5,7 +5,7 @@ if [ ! -e /mmdebstrap-testenv ]; then echo "this test modifies the system and should only be run inside a container" >&2 exit 1 fi -apt-get remove --yes qemu-user-static binfmt-support qemu-user +apt-get remove --yes qemu-user-binfmt binfmt-support qemu-user # the following is not necessary anymore since systemd-binfmt # successfully disables support upon removal of qemu-user with # the upload of src:systemd 251.2-4: https://bugs.debian.org/1012163 diff --git a/tests/i386-which-can-be-executed-without-qemu b/tests/i386-which-can-be-executed-without-qemu index 91c53df..dd48b39 100644 --- a/tests/i386-which-can-be-executed-without-qemu +++ b/tests/i386-which-can-be-executed-without-qemu @@ -6,7 +6,7 @@ if [ ! -e /mmdebstrap-testenv ]; then exit 1 fi # remove qemu just to be sure -apt-get remove --yes qemu-user-static binfmt-support qemu-user +apt-get remove --yes qemu-user-binfmt binfmt-support qemu-user {{ CMD }} --mode={{ MODE }} --variant=apt --architectures=i386 {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }} # we ignore differences between architectures by ignoring some files # and renaming others diff --git a/tests/mmdebstrap b/tests/mmdebstrap index f383ec4..39486e6 100644 --- a/tests/mmdebstrap +++ b/tests/mmdebstrap @@ -14,7 +14,7 @@ case {{ FORMAT }} in tar|squashfs|ext2|ext4) : ;; *) exit 1;; esac # https://lore.kernel.org/linux-ext4/171484520952.2626447.2160419274451668597@localhost/T/#t mv /tmp/mmdebstrap-{{ DIST }}-{{ VARIANT }}.{{ FORMAT }} ./cache/mmdebstrap-{{ DIST }}-{{ VARIANT }}.{{ FORMAT }} if [ "{{ FORMAT }}" = tar ]; then - printf 'ustar ' | cmp --bytes=6 --ignore-initial=257:0 ./cache/mmdebstrap-{{ DIST }}-{{ VARIANT }}.tar - + printf 'ustar\0' | cmp --bytes=6 --ignore-initial=257:0 ./cache/mmdebstrap-{{ DIST }}-{{ VARIANT }}.tar - elif [ "{{ FORMAT }}" = squashfs ]; then printf 'hsqs' | cmp --bytes=4 ./cache/mmdebstrap-{{ DIST }}-{{ VARIANT }}.squashfs - elif [ "{{ FORMAT }}" = ext2 ]; then diff --git a/tests/zombie-reaping b/tests/zombie-reaping new file mode 100644 index 0000000..83c9c1b --- /dev/null +++ b/tests/zombie-reaping @@ -0,0 +1,39 @@ +#!/bin/sh +set -eu +export LC_ALL=C.UTF-8 +export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }} + +[ {{ MODE }} = "unshare" ] + +trap "rm -f /tmp/debian-chroot.tar" EXIT INT TERM + +prefix= +if [ "$(id -u)" -eq 0 ] && [ "{{ MODE }}" != "root" ] && [ "{{ MODE }}" != "auto" ]; then + if ! id "${SUDO_USER:-user}" >/dev/null 2>&1; then + if [ ! -e /mmdebstrap-testenv ]; then + echo "this test modifies the system and should only be run inside a container" >&2 + exit 1 + fi + useradd --home-dir "/home/${SUDO_USER:-user}" --create-home "${SUDO_USER:-user}" + fi + prefix="runuser -u ${SUDO_USER:-user} --" +fi + +MMTARFILTER= +[ -x /usr/bin/mmtarfilter ] && MMTARFILTER=/usr/bin/mmtarfilter +[ -x ./tarfilter ] && MMTARFILTER=./tarfilter + +$prefix {{ CMD }} --mode={{ MODE }} --variant=apt \ + --skip=output/dev \ + --customize-hook='chroot "$1" sh -c "sleep 1m > /dev/null" &' \ + {{ DIST }} - {{ MIRROR }} \ + | "$MMTARFILTER" --path-exclude="/dev" \ + > /tmp/debian-chroot.tar + +origfilter() { + < ./cache/mmdebstrap-{{ DIST }}-apt.tar \ + "$MMTARFILTER" --path-exclude="/dev/*" --path-exclude="/dev" +} + +origfilter | cmp - /tmp/debian-chroot.tar \ + || origfilter | diffoscope - /tmp/debian-chroot.tar |