coverage.sh: allow running tests on architectures other than amd64 with reduced functionality

This commit is contained in:
Johannes 'josch' Schauer 2020-01-06 11:10:31 +01:00
parent 4daae7e9be
commit dc7663b3a8
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1
2 changed files with 41 additions and 15 deletions

View file

@ -16,6 +16,8 @@ rm -f shared/cover_db.img
: "${HAVE_QEMU:=yes}" : "${HAVE_QEMU:=yes}"
: "${RUN_MA_SAME_TESTS:=yes}" : "${RUN_MA_SAME_TESTS:=yes}"
HOSTARCH=$(dpkg --print-architecture)
if [ "$HAVE_QEMU" = "yes" ]; then if [ "$HAVE_QEMU" = "yes" ]; then
# prepare image for cover_db # prepare image for cover_db
guestfish -N shared/cover_db.img=disk:256M -- mkfs vfat /dev/sda guestfish -N shared/cover_db.img=disk:256M -- mkfs vfat /dev/sda
@ -176,7 +178,7 @@ if [ -e "/tmp/debian-$dist-debootstrap/run/mount" ]; then
rmdir "/tmp/debian-$dist-debootstrap/run/mount" rmdir "/tmp/debian-$dist-debootstrap/run/mount"
fi fi
# debootstrap doesn't clean apt # debootstrap doesn't clean apt
rm /tmp/debian-$dist-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_${dist}_main_binary-amd64_Packages \ rm /tmp/debian-$dist-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_${dist}_main_binary-${HOSTARCH}_Packages \
/tmp/debian-$dist-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_${dist}_Release \ /tmp/debian-$dist-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_${dist}_Release \
/tmp/debian-$dist-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_${dist}_Release.gpg /tmp/debian-$dist-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_${dist}_Release.gpg
@ -886,7 +888,9 @@ if [ "\$ret" = 0 ]; then
exit 1 exit 1
fi fi
END END
if [ "$HAVE_QEMU" = "yes" ]; then if [ "$HOSTARCH" != amd64 ]; then
echo "HOSTARCH != amd64 -- Skipping test..."
elif [ "$HAVE_QEMU" = "yes" ]; then
./run_qemu.sh ./run_qemu.sh
else else
echo "HAVE_QEMU != yes -- Skipping test..." echo "HAVE_QEMU != yes -- Skipping test..."
@ -933,7 +937,9 @@ $CMD --mode=$defaultmode --variant=apt --architectures=i386 $DEFAULT_DIST /tmp/d
} | sort | diff -u - tar2.txt } | sort | diff -u - tar2.txt
rm /tmp/debian-chroot.tar rm /tmp/debian-chroot.tar
END END
if [ "$HAVE_QEMU" = "yes" ]; then if [ "$HOSTARCH" != amd64 ]; then
echo "HOSTARCH != amd64 -- Skipping test..."
elif [ "$HAVE_QEMU" = "yes" ]; then
./run_qemu.sh ./run_qemu.sh
else else
echo "HAVE_QEMU != yes -- Skipping test..." echo "HAVE_QEMU != yes -- Skipping test..."
@ -970,7 +976,9 @@ tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.
rm -r /tmp/debian-chroot rm -r /tmp/debian-chroot
END END
if [ "$RUN_MA_SAME_TESTS" = "yes" ]; then if [ "$RUN_MA_SAME_TESTS" = "yes" ]; then
if [ "$HAVE_QEMU" = "yes" ]; then if [ "$HOSTARCH" != amd64 ]; then
echo "HOSTARCH != amd64 -- Skipping test..."
elif [ "$HAVE_QEMU" = "yes" ]; then
./run_qemu.sh ./run_qemu.sh
else else
./run_null.sh SUDO ./run_null.sh SUDO
@ -1005,7 +1013,9 @@ tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.
rm -r /tmp/debian-chroot rm -r /tmp/debian-chroot
END END
if [ "$RUN_MA_SAME_TESTS" = "yes" ]; then if [ "$RUN_MA_SAME_TESTS" = "yes" ]; then
if [ "$HAVE_QEMU" = "yes" ]; then if [ "$HOSTARCH" != amd64 ]; then
echo "HOSTARCH != amd64 -- Skipping test..."
elif [ "$HAVE_QEMU" = "yes" ]; then
./run_qemu.sh ./run_qemu.sh
else else
./run_null.sh SUDO ./run_null.sh SUDO
@ -1988,7 +1998,9 @@ rm /tmp/debian-chroot/var/lib/dpkg/info/libmagic-mgc.list
# the rest should be empty directories that we can rmdir recursively # the rest should be empty directories that we can rmdir recursively
find /tmp/debian-chroot -depth -print0 | xargs -0 rmdir find /tmp/debian-chroot -depth -print0 | xargs -0 rmdir
END END
if [ "$HAVE_BINFMT" = "yes" ]; then if [ "$HOSTARCH" != amd64 ]; then
echo "HOSTARCH != amd64 -- Skipping test..."
elif [ "$HAVE_BINFMT" = "yes" ]; then
if [ "$HAVE_QEMU" = "yes" ]; then if [ "$HAVE_QEMU" = "yes" ]; then
./run_qemu.sh ./run_qemu.sh
else else
@ -2038,6 +2050,10 @@ fi
for mode in root unshare fakechroot proot; do for mode in root unshare fakechroot proot; do
print_header "mode=$mode,variant=apt: create armhf tarball" print_header "mode=$mode,variant=apt: create armhf tarball"
if [ "$HOSTARCH" != amd64 ]; then
echo "HOSTARCH != amd64 -- Skipping test..."
continue
fi
if [ "$HAVE_BINFMT" != "yes" ]; then if [ "$HAVE_BINFMT" != "yes" ]; then
echo "HAVE_BINFMT != yes -- Skipping test..." echo "HAVE_BINFMT != yes -- Skipping test..."
continue continue

View file

@ -326,14 +326,11 @@ newmirrordir="$newcachedir/debian"
mirror="http://deb.debian.org/debian" mirror="http://deb.debian.org/debian"
security_mirror="http://security.debian.org/debian-security" security_mirror="http://security.debian.org/debian-security"
if [ "$(dpkg --print-architecture)" != amd64 ]; then
echo "script only supports being run on amd64" >&2
exit 1
fi
components=main components=main
: "${DEFAULT_DIST:=unstable}" : "${DEFAULT_DIST:=unstable}"
: "${HAVE_QEMU:=yes}" : "${HAVE_QEMU:=yes}"
: "${RUN_MA_SAME_TESTS:=yes}"
if [ -e "$oldmirrordir/dists/$DEFAULT_DIST/Release" ]; then if [ -e "$oldmirrordir/dists/$DEFAULT_DIST/Release" ]; then
http_code=$(curl --output /dev/null --silent --location --head --time-cond "$oldmirrordir/dists/$DEFAULT_DIST/Release" --write-out '%{http_code}' "$mirror/dists/$DEFAULT_DIST/Release") http_code=$(curl --output /dev/null --silent --location --head --time-cond "$oldmirrordir/dists/$DEFAULT_DIST/Release" --write-out '%{http_code}' "$mirror/dists/$DEFAULT_DIST/Release")
@ -349,10 +346,17 @@ trap "cleanup_newcachedir" EXIT INT TERM
mkdir -p "$newcachedir" mkdir -p "$newcachedir"
touch "$newcachedir/mmdebstrapcache" touch "$newcachedir/mmdebstrapcache"
for nativearch in amd64 armhf i386; do HOSTARCH=$(dpkg --print-architecture)
if [ "$HOSTARCH" = amd64 ]; then
arches="amd64 armhf i386"
else
arches="$HOSTARCH"
fi
for nativearch in $arches; do
for dist in stable testing unstable; do for dist in stable testing unstable; do
# only store non-amd64 architectures for $DEFAULT_DIST # non-host architectures are only downloaded for $DEFAULT_DIST
if [ $nativearch != amd64 ] && [ $DEFAULT_DIST != $dist ]; then if [ $nativearch != $HOSTARCH ] && [ $DEFAULT_DIST != $dist ]; then
continue continue
fi fi
cat << END | update_cache "$dist" "$nativearch" cat << END | update_cache "$dist" "$nativearch"
@ -403,8 +407,14 @@ if [ "$HAVE_QEMU" = "yes" ]; then
tmpdir="$(mktemp -d)" tmpdir="$(mktemp -d)"
trap "cleanuptmpdir; cleanup_newcachedir" EXIT INT TERM trap "cleanuptmpdir; cleanup_newcachedir" EXIT INT TERM
./mmdebstrap --variant=apt --architectures=amd64,armhf \ pkgs=perl-doc,linux-image-amd64,systemd-sysv,perl,arch-test,fakechroot,fakeroot,mount,uidmap,proot,qemu-user-static,binfmt-support,qemu-user,dpkg-dev,mini-httpd,libdevel-cover-perl,debootstrap,procps,apt-cudf,aspcud
--include=perl-doc,linux-image-amd64,systemd-sysv,perl,arch-test,fakechroot,fakeroot,mount,uidmap,proot,qemu-user-static,binfmt-support,qemu-user,dpkg-dev,mini-httpd,libdevel-cover-perl,debootstrap,libfakechroot:armhf,libfakeroot:armhf,procps,apt-cudf,aspcud \ if [ "$HOSTARCH" = amd64 ] && [ "$RUN_MA_SAME_TESTS" = "yes" ]; then
arches=amd64,armhf
pkgs="$pkgs,libfakechroot:armhf,libfakeroot:armhf"
else
arches=$HOSTARCH
fi
./mmdebstrap --variant=apt --architectures=$arches --include="$pkgs" \
$DEFAULT_DIST - "$mirror" > "$tmpdir/debian-chroot.tar" $DEFAULT_DIST - "$mirror" > "$tmpdir/debian-chroot.tar"
cat << END > "$tmpdir/extlinux.conf" cat << END > "$tmpdir/extlinux.conf"