From cc5ea8c0c71d61fa5667df428f94d439f394ebb7 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Mon, 16 Jan 2023 08:14:36 +0100 Subject: [PATCH] tests/chrootless: now that all of essential is supported, test everything --- coverage.txt | 2 +- tests/chrootless | 6 +----- tests/chrootless-fakeroot | 2 +- tests/chrootless-foreign | 38 ++++++++++++++++++++++++++++++-------- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/coverage.txt b/coverage.txt index 40dc033..80be7ec 100644 --- a/coverage.txt +++ b/coverage.txt @@ -307,7 +307,7 @@ Variants: essential Modes: chrootless Skip-If: dist in ["oldstable", "stable"] - hostarch != "amd64" + hostarch not in ["amd64", "arm64"] not run_ma_same_tests Needs-QEMU: true diff --git a/tests/chrootless b/tests/chrootless index 8f86992..e182173 100644 --- a/tests/chrootless +++ b/tests/chrootless @@ -2,14 +2,10 @@ set -eu export LC_ALL=C.UTF-8 export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }} -if dpkg --compare-versions "$(dpkg-query -W -f='${Version}' libpam-runtime)" le 1.5.2-5; then - # https://bugs.debian.org/1022952 - exit 0 -fi trap "rm -f /tmp/chrootless.tar /tmp/root.tar" EXIT INT TERM # we need --hook-dir=./hooks/merged-usr because usrmerge does not understand # DPKG_ROOT -for INCLUDE in '' 'systemd-sysv'; do +for INCLUDE in '' 'apt' 'apt,build-essential' 'systemd-sysv'; do for MODE in root chrootless; do {{ CMD }} --mode=$MODE --variant={{ VARIANT }} --hook-dir=./hooks/merged-usr \ ${INCLUDE:+--include="$INCLUDE"} \ diff --git a/tests/chrootless-fakeroot b/tests/chrootless-fakeroot index 9d83df9..83cc0d5 100644 --- a/tests/chrootless-fakeroot +++ b/tests/chrootless-fakeroot @@ -16,7 +16,7 @@ prefix= # DPKG_ROOT # permissions drwxr-sr-x and extended attributes of ./var/log/journal/ cannot # be preserved under fakeroot -for INCLUDE in '' 'systemd-sysv'; do +for INCLUDE in '' 'apt' 'apt,build-essential' 'systemd-sysv'; do {{ CMD }} --variant={{ VARIANT }} --hook-dir=./hooks/merged-usr \ --customize-hook='if [ -d "$1"/var/log/journal ]; then rmdir "$1"/var/log/journal; mkdir --mode=2755 "$1"/var/log/journal; chroot "$1" chown root:systemd-journal /var/log/journal; fi' \ ${INCLUDE:+--include="$INCLUDE"} \ diff --git a/tests/chrootless-foreign b/tests/chrootless-foreign index b4a049a..430c9c4 100644 --- a/tests/chrootless-foreign +++ b/tests/chrootless-foreign @@ -8,20 +8,42 @@ if [ ! -e /mmdebstrap-testenv ]; then exit 1 fi +deb2qemu() { + case "$1" in + amd64) echo x86_64;; + arm64) echo aarch64;; + armel|armhf) echo arm;; + ppc64el) echo ppc64le;; + *) echo "$1";; + esac +} +if [ "$(dpkg --print-architecture)" = "arm64" ]; then + arch=amd64 +else + arch=arm64 +fi + [ "$(id -u)" -eq 0 ] -[ -e /proc/sys/fs/binfmt_misc/qemu-aarch64 ] +[ -e "/proc/sys/fs/binfmt_misc/qemu-$(deb2qemu "$arch")" ] + # we need --hook-dir=./hooks/merged-usr because usrmerge does not understand # DPKG_ROOT -for INCLUDE in '' 'systemd-sysv'; do - echo 1 > /proc/sys/fs/binfmt_misc/qemu-aarch64 - arch-test arm64 - {{ CMD }} --mode=root --architecture=arm64 --variant={{ VARIANT }} \ +# +# dpkg is unable to install architecture arch:all packages with a +# dependency on an arch:any package (perl-modules-5.34 in this case) +# inside foreign architecture chrootless chroots, because dpkg will use +# its own architecture as the native architecture, see #825385 and #1020533 +# So we are not testing the installation of apt,build-essential here. +for INCLUDE in '' 'apt' 'systemd-sysv'; do + echo 1 > "/proc/sys/fs/binfmt_misc/qemu-$(deb2qemu "$arch")" + arch-test "$arch" + {{ CMD }} --mode=root --architecture="$arch" --variant={{ VARIANT }} \ --hook-dir=./hooks/merged-usr ${INCLUDE:+--include="$INCLUDE"} \ {{ DIST }} "/tmp/root.tar" {{ MIRROR }} - echo 0 > /proc/sys/fs/binfmt_misc/qemu-aarch64 - arch-test arm64 && exit 1 - {{ CMD }} --mode=chrootless --architecture=arm64 --variant={{ VARIANT }} \ + echo 0 > "/proc/sys/fs/binfmt_misc/qemu-$(deb2qemu "$arch")" + arch-test "$arch" && exit 1 + {{ CMD }} --mode=chrootless --architecture="$arch" --variant={{ VARIANT }} \ --hook-dir=./hooks/merged-usr ${INCLUDE:+--include="$INCLUDE"} \ {{ DIST }} "/tmp/chrootless.tar" {{ MIRROR }} # when creating a foreign architecture chroot, the tarballs are not