forked from josch/mmdebstrap
tests: test chrootless essential and systemd-sysv with fakeroot and foreign
This commit is contained in:
parent
b5f6c7f08f
commit
822f8eafec
5 changed files with 108 additions and 15 deletions
19
coverage.txt
19
coverage.txt
|
@ -288,12 +288,27 @@ Test: install-doc-debian
|
||||||
Modes: chrootless
|
Modes: chrootless
|
||||||
Variants: custom
|
Variants: custom
|
||||||
|
|
||||||
Test: chrootless-essential
|
Test: chrootless
|
||||||
Variants: custom
|
Variants: essential
|
||||||
Modes: chrootless
|
Modes: chrootless
|
||||||
Skip-If:
|
Skip-If:
|
||||||
dist in ["oldstable", "stable"]
|
dist in ["oldstable", "stable"]
|
||||||
|
|
||||||
|
Test: chrootless-fakeroot
|
||||||
|
Variants: essential
|
||||||
|
Modes: chrootless
|
||||||
|
Skip-If:
|
||||||
|
dist in ["oldstable", "stable"]
|
||||||
|
|
||||||
|
Test: chrootless-foreign
|
||||||
|
Variants: essential
|
||||||
|
Modes: chrootless
|
||||||
|
Skip-If:
|
||||||
|
dist in ["oldstable", "stable"]
|
||||||
|
hostarch != "amd64"
|
||||||
|
not run_ma_same_tests
|
||||||
|
Needs-QEMU: true
|
||||||
|
|
||||||
Test: install-doc-debian-and-output-tarball
|
Test: install-doc-debian-and-output-tarball
|
||||||
Variants: custom
|
Variants: custom
|
||||||
Modes: chrootless
|
Modes: chrootless
|
||||||
|
|
16
tests/chrootless
Normal file
16
tests/chrootless
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
|
export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }}
|
||||||
|
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 MODE in root chrootless; do
|
||||||
|
{{ CMD }} --mode=$MODE --variant={{ VARIANT }} --hook-dir=./hooks/merged-usr \
|
||||||
|
${INCLUDE:+--include="$INCLUDE"} \
|
||||||
|
{{ DIST }} "/tmp/$MODE.tar" {{ MIRROR }}
|
||||||
|
done
|
||||||
|
cmp /tmp/root.tar /tmp/chrootless.tar
|
||||||
|
rm /tmp/chrootless.tar /tmp/root.tar
|
||||||
|
done
|
|
@ -1,13 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -eu
|
|
||||||
export LC_ALL=C.UTF-8
|
|
||||||
if [ "$(id -u)" -eq 0 ] && ! id -u 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
|
|
||||||
adduser --gecos user --disabled-password user
|
|
||||||
fi
|
|
||||||
prefix=
|
|
||||||
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
|
||||||
$prefix fakechroot fakeroot {{ CMD }} --mode=chrootless --variant=essential {{ DIST }} /dev/null {{ MIRROR }}
|
|
29
tests/chrootless-fakeroot
Normal file
29
tests/chrootless-fakeroot
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
|
export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }}
|
||||||
|
trap "rm -f /tmp/chrootless.tar /tmp/root.tar" EXIT INT TERM
|
||||||
|
if [ "$(id -u)" -eq 0 ] && ! id -u 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
|
||||||
|
adduser --gecos user --disabled-password user
|
||||||
|
fi
|
||||||
|
prefix=
|
||||||
|
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
||||||
|
# we need --hook-dir=./hooks/merged-usr because usrmerge does not understand
|
||||||
|
# DPKG_ROOT
|
||||||
|
# permissions drwxr-sr-x and extended attributes of ./var/log/journal/ cannot
|
||||||
|
# be preserved under fakeroot
|
||||||
|
for INCLUDE in '' '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"} \
|
||||||
|
{{ DIST }} /tmp/root.tar {{ MIRROR }}
|
||||||
|
$prefix fakeroot {{ CMD }} --mode=chrootless --variant={{ VARIANT }} --hook-dir=./hooks/merged-usr \
|
||||||
|
${INCLUDE:+--include="$INCLUDE"} \
|
||||||
|
{{ DIST }} /tmp/chrootless.tar {{ MIRROR }}
|
||||||
|
cmp /tmp/root.tar /tmp/chrootless.tar
|
||||||
|
rm /tmp/chrootless.tar /tmp/root.tar
|
||||||
|
done
|
46
tests/chrootless-foreign
Normal file
46
tests/chrootless-foreign
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
|
export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }}
|
||||||
|
trap "rm -f /tmp/chrootless.tar /tmp/root.tar" EXIT INT TERM
|
||||||
|
if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "$(id -u)" -eq 0 ]
|
||||||
|
[ -e /proc/sys/fs/binfmt_misc/qemu-aarch64 ]
|
||||||
|
|
||||||
|
# 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 }} \
|
||||||
|
--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
|
||||||
|
{{ CMD }} --mode=chrootless --architecture=arm64 --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
|
||||||
|
# bit-by-bit identical but contain a few remaining differences:
|
||||||
|
#
|
||||||
|
# * /etc/ld.so.cache -- hard problem, must be solved in glibc upstream
|
||||||
|
# * /var/lib/dpkg/triggers -- #990712
|
||||||
|
# * /var/cache/debconf/*.dat-old -- needs investigation
|
||||||
|
for tar in root chrootless; do
|
||||||
|
<"/tmp/$tar.tar" \
|
||||||
|
./tarfilter \
|
||||||
|
--path-exclude=/var/cache/debconf/config.dat-old \
|
||||||
|
--path-exclude=/var/cache/debconf/templates.dat-old \
|
||||||
|
--path-exclude=/etc/ld.so.cache \
|
||||||
|
--path-exclude=/var/lib/dpkg/triggers/File \
|
||||||
|
--path-exclude=/var/lib/dpkg/triggers/ldconfig \
|
||||||
|
> "/tmp/$tar.tar.tmp"
|
||||||
|
mv "/tmp/$tar.tar.tmp" "/tmp/$tar.tar"
|
||||||
|
done
|
||||||
|
cmp /tmp/root.tar /tmp/chrootless.tar
|
||||||
|
rm /tmp/chrootless.tar /tmp/root.tar
|
||||||
|
done
|
Loading…
Reference in a new issue