coverage.sh: check bit-by-bit identical squashfs and ext2 output using S_D_E between root and unshare modes
This commit is contained in:
parent
ccae6de410
commit
c0ee8c82db
1 changed files with 35 additions and 17 deletions
38
coverage.sh
38
coverage.sh
|
@ -72,7 +72,7 @@ if [ ! -e shared/taridshift ] || [ taridshift -nt shared/taridshift ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
starttime=
|
starttime=
|
||||||
total=146
|
total=148
|
||||||
skipped=0
|
skipped=0
|
||||||
runtests=0
|
runtests=0
|
||||||
i=1
|
i=1
|
||||||
|
@ -396,7 +396,8 @@ else
|
||||||
skipped=$((skipped+1))
|
skipped=$((skipped+1))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
print_header "mode=unshare/root,variant=debootstrap: check for bit-by-bit identical output"
|
for format in tar squashfs ext2; do
|
||||||
|
print_header "mode=unshare/root,variant=debootstrap: check for bit-by-bit identical $format output"
|
||||||
cat << END > shared/test.sh
|
cat << END > shared/test.sh
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
|
@ -408,10 +409,19 @@ fi
|
||||||
adduser --gecos user --disabled-password user
|
adduser --gecos user --disabled-password user
|
||||||
sysctl -w kernel.unprivileged_userns_clone=1
|
sysctl -w kernel.unprivileged_userns_clone=1
|
||||||
export SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH
|
export SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH
|
||||||
$CMD --mode=root --variant=debootstrap $DEFAULT_DIST /tmp/debian-chroot-root.tar $mirror
|
$CMD --mode=root --variant=debootstrap $DEFAULT_DIST /tmp/debian-chroot-root.$format $mirror
|
||||||
runuser -u user -- $CMD --mode=unshare --variant=debootstrap $DEFAULT_DIST /tmp/debian-chroot-unshare.tar $mirror
|
if [ "$format" = tar ]; then
|
||||||
cmp /tmp/debian-chroot-root.tar /tmp/debian-chroot-unshare.tar
|
printf 'ustar ' | cmp --bytes=6 --ignore-initial=257:0 /tmp/debian-chroot-root.tar -
|
||||||
rm /tmp/debian-chroot-root.tar /tmp/debian-chroot-unshare.tar
|
elif [ "$format" = squashfs ]; then
|
||||||
|
printf 'hsqs' | cmp --bytes=4 /tmp/debian-chroot-root.squashfs -
|
||||||
|
elif [ "$format" = ext2 ]; then
|
||||||
|
printf '\123\357' | cmp --bytes=2 --ignore-initial=1080:0 /tmp/debian-chroot-root.ext2 -
|
||||||
|
else
|
||||||
|
echo "unknown format: $format" >&2
|
||||||
|
fi
|
||||||
|
runuser -u user -- $CMD --mode=unshare --variant=debootstrap $DEFAULT_DIST /tmp/debian-chroot-unshare.$format $mirror
|
||||||
|
cmp /tmp/debian-chroot-root.$format /tmp/debian-chroot-unshare.$format
|
||||||
|
rm /tmp/debian-chroot-root.$format /tmp/debian-chroot-unshare.$format
|
||||||
END
|
END
|
||||||
if [ "$HAVE_QEMU" = "yes" ]; then
|
if [ "$HAVE_QEMU" = "yes" ]; then
|
||||||
./run_qemu.sh
|
./run_qemu.sh
|
||||||
|
@ -420,6 +430,7 @@ else
|
||||||
echo "HAVE_QEMU != yes -- Skipping test..." >&2
|
echo "HAVE_QEMU != yes -- Skipping test..." >&2
|
||||||
skipped=$((skipped+1))
|
skipped=$((skipped+1))
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
print_header "mode=unshare,variant=apt: test taridshift utility"
|
print_header "mode=unshare,variant=apt: test taridshift utility"
|
||||||
cat << END > shared/test.sh
|
cat << END > shared/test.sh
|
||||||
|
@ -786,15 +797,17 @@ prefix=
|
||||||
[ "\$(id -u)" -eq 0 ] && [ "$mode" != "root" ] && prefix="runuser -u user --"
|
[ "\$(id -u)" -eq 0 ] && [ "$mode" != "root" ] && prefix="runuser -u user --"
|
||||||
[ "$mode" = "fakechroot" ] && prefix="\$prefix fakechroot fakeroot"
|
[ "$mode" = "fakechroot" ] && prefix="\$prefix fakechroot fakeroot"
|
||||||
\$prefix $CMD --mode=$mode --variant=apt $DEFAULT_DIST /tmp/debian-chroot.ext2 $mirror
|
\$prefix $CMD --mode=$mode --variant=apt $DEFAULT_DIST /tmp/debian-chroot.ext2 $mirror
|
||||||
mount /tmp/debian-chroot.ext2 /mnt
|
mkdir /tmp/mnt
|
||||||
rmdir /mnt/lost+found
|
mount /tmp/debian-chroot.ext2 /tmp/mnt
|
||||||
|
rmdir /tmp/mnt/lost+found
|
||||||
# in fakechroot mode, we use a fake ldconfig, so we have to
|
# in fakechroot mode, we use a fake ldconfig, so we have to
|
||||||
# artificially add some files
|
# artificially add some files
|
||||||
{ tar -C /mnt -c . | tar -t;
|
{ tar -C /tmp/mnt -c . | tar -t;
|
||||||
[ "$mode" = "fakechroot" ] && printf "./etc/ld.so.cache\n./var/cache/ldconfig/\n";
|
[ "$mode" = "fakechroot" ] && printf "./etc/ld.so.cache\n./var/cache/ldconfig/\n";
|
||||||
[ "$mode" = "fakechroot" ] && printf "./etc/.pwd.lock\n";
|
[ "$mode" = "fakechroot" ] && printf "./etc/.pwd.lock\n";
|
||||||
} | sort | diff -u tar1.txt -
|
} | sort | diff -u tar1.txt -
|
||||||
umount /mnt
|
umount /tmp/mnt
|
||||||
|
rmdir /tmp/mnt
|
||||||
rm /tmp/debian-chroot.ext2
|
rm /tmp/debian-chroot.ext2
|
||||||
END
|
END
|
||||||
if [ "$HAVE_QEMU" = "yes" ]; then
|
if [ "$HAVE_QEMU" = "yes" ]; then
|
||||||
|
@ -2770,6 +2783,11 @@ for mode in root unshare fakechroot proot; do
|
||||||
skipped=$((skipped+1))
|
skipped=$((skipped+1))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
if [ "$RUN_MA_SAME_TESTS" != yes ]; then
|
||||||
|
echo "RUN_MA_SAME_TESTS != yes -- Skipping test..." >&2
|
||||||
|
skipped=$((skipped+1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
if [ "$HAVE_BINFMT" != "yes" ]; then
|
if [ "$HAVE_BINFMT" != "yes" ]; then
|
||||||
echo "HAVE_BINFMT != yes -- Skipping test..." >&2
|
echo "HAVE_BINFMT != yes -- Skipping test..." >&2
|
||||||
skipped=$((skipped+1))
|
skipped=$((skipped+1))
|
||||||
|
|
Loading…
Reference in a new issue