coverage.sh: add test auto-mode without unshare capabilities

This commit is contained in:
Johannes 'josch' Schauer 2019-03-27 11:29:36 +01:00
parent 454dd9fa3e
commit 055af094ea
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -52,7 +52,7 @@ if [ ! -e shared/mmdebstrap ] || [ mmdebstrap -nt shared/mmdebstrap ]; then
fi fi
starttime= starttime=
total=89 total=90
i=1 i=1
print_header() { print_header() {
@ -378,6 +378,25 @@ else
echo "HAVE_QEMU != yes -- Skipping test..." echo "HAVE_QEMU != yes -- Skipping test..."
fi fi
print_header "mode=auto,variant=apt: test auto-mode without unshare capabilities"
cat << END > shared/test.sh
#!/bin/sh
set -eu
export LC_ALL=C.UTF-8
adduser --gecos user --disabled-password user
sysctl -w kernel.unprivileged_userns_clone=0
runuser -u user -- $CMD --mode=auto --variant=apt $DEFAULT_DIST /tmp/debian-chroot.tar.gz $mirror
{ tar -tf /tmp/debian-chroot.tar.gz;
printf "./etc/ld.so.cache\n./var/cache/ldconfig/\n./etc/.pwd.lock\n";
} | sort | diff -u tar1.txt -
rm /tmp/debian-chroot.tar.gz
END
if [ "$HAVE_QEMU" = "yes" ]; then
./run_qemu.sh
else
echo "HAVE_QEMU != yes -- Skipping test..."
fi
print_header "mode=root,variant=apt: fail with missing lz4" print_header "mode=root,variant=apt: fail with missing lz4"
cat << END > shared/test.sh cat << END > shared/test.sh
#!/bin/sh #!/bin/sh
@ -1196,8 +1215,6 @@ END
fi fi
done done
# TODO: test if auto mode picks the right mode
if [ "$HAVE_QEMU" = "yes" ]; then if [ "$HAVE_QEMU" = "yes" ]; then
guestfish add-ro shared/cover_db.img : run : mount /dev/sda / : tar-out / - \ guestfish add-ro shared/cover_db.img : run : mount /dev/sda / : tar-out / - \
| tar -C shared/cover_db --extract | tar -C shared/cover_db --extract