osi-tools/runtests

207 lines
6.1 KiB
Plaintext
Raw Normal View History

2018-08-12 02:26:38 +00:00
#!/usr/bin/make -f
2018-08-06 01:49:45 +00:00
# 2018 Luke Shumaker
2018-08-06 00:09:42 +00:00
2018-08-12 21:56:54 +00:00
# Runtime/user options #########################################################
GITREV ?= systemd/v239.0-2.parabola7
2018-08-13 05:16:36 +00:00
WORKDIR ?= workdir
2018-08-06 00:09:42 +00:00
2018-08-12 21:56:54 +00:00
################################################################################
# Main #
################################################################################
2018-08-12 02:26:38 +00:00
# Configure Make ###############################################################
2018-08-12 21:56:54 +00:00
2018-08-12 02:26:38 +00:00
.ONESHELL:
2018-08-12 21:56:54 +00:00
SHELL = bash
.SHELLFLAGS = -veE -o pipefail -c
.SILENT:
2018-08-12 02:26:38 +00:00
.DELETE_ON_ERROR:
.SECONDARY:
2018-08-12 21:56:54 +00:00
.DEFAULT_GOAL = check
2018-08-12 02:26:38 +00:00
################################################################################
2018-08-12 21:56:54 +00:00
2018-08-12 02:26:38 +00:00
.PHONY: FORCE
2018-08-12 21:56:54 +00:00
# git ##########################################################################
2018-08-12 02:26:38 +00:00
${WORKDIR}/systemd.git: FORCE
mkdir -p -- '$(@D)'
gitget bare https://git.parabola.nu/~lukeshu/systemd.git '$@'
test -d '$@'
touch '$@'
${WORKDIR}/.COMMIT.mk: ${WORKDIR}/systemd.git
2018-08-12 21:56:54 +00:00
( cd $< && git rev-parse --verify '${GITREV}' ) | sed 's/^/COMMIT=/' | ./write-ifchanged '$@'
2018-08-12 02:26:38 +00:00
-include ${WORKDIR}/.COMMIT.mk
check: ${WORKDIR}/build-232/pkgdest
check: ${WORKDIR}/build-$(COMMIT)/pkgdest
check: ${WORKDIR}/build-$(COMMIT)/sd-tests-integration.log
check: ${WORKDIR}/build-$(COMMIT)/sd-tests-unit.log
.PHONY: check
2018-08-12 21:56:54 +00:00
# osi-mk base images ###########################################################
2018-08-15 01:15:21 +00:00
${WORKDIR}/base.raw: osi-mk.d/systemd-osi-shell.sh
2018-08-12 21:56:54 +00:00
${WORKDIR}/base.raw:
rm -f -- '$@' '$@.tmp'
2018-08-12 21:56:54 +00:00
mkdir -p -- '$(@D)'
./osi-mk \
2018-08-16 05:48:21 +00:00
--size=2G \
--package='base' \
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
'$@.tmp'
mv -T -- '$@.tmp' '$@'
2018-08-12 21:56:54 +00:00
${WORKDIR}/build.raw: ${WORKDIR}/base.raw
${WORKDIR}/build.raw: osi-mk.d/libretools.sh
${WORKDIR}/build.raw: osi-mk.d/builddeps.sh
${WORKDIR}/build.raw: osi-mk.d/systemd-dhcpcd.sh
${WORKDIR}/build.raw:
2018-08-13 04:35:44 +00:00
rm -f -- '$@' '$@.tmp'
./osi-mk \
--edit='$(filter %.raw,$^)' \
2018-08-16 05:48:21 +00:00
--size=3G \
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
'$@.tmp'
2018-08-15 01:15:21 +00:00
./osi-shell '$@.tmp' <<-'EOF'
su testuser || exit
set -e
libreblacklist update
sudo librechroot make
2018-08-12 21:56:54 +00:00
EOF
2018-08-13 04:35:44 +00:00
mv -T -- '$@.tmp' '$@'
2018-08-12 21:56:54 +00:00
# build systemd ################################################################
# build systemd 232
${WORKDIR}/build-232/build.raw: ${WORKDIR}/build.raw
2018-08-12 22:49:35 +00:00
${WORKDIR}/build-232/build.raw: osi-mk.d/testuser.sh
2018-08-12 02:26:38 +00:00
${WORKDIR}/build-232/build.raw: abs/systemd-232 $(wildcard abs/systemd-232/*)
${WORKDIR}/build-232/build.raw: | ${WORKDIR}/systemd.git
${WORKDIR}/build-232/build.raw:
2018-08-13 04:35:44 +00:00
rm -f -- '$@' '$@.tmp'
2018-08-12 22:16:27 +00:00
mkdir -p -- '$(@D)'
2018-08-06 01:56:44 +00:00
./osi-mk \
--edit='$(filter %.raw,$^)' \
2018-08-16 05:48:21 +00:00
--size=4G \
2018-08-12 21:56:54 +00:00
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
2018-08-12 22:16:27 +00:00
--directory='${WORKDIR}/systemd.git:/home/testuser/packages/srcdest/systemd' \
--directory='abs/systemd-232:/home/testuser/packages/abs/systemd' \
2018-08-13 04:35:44 +00:00
'$@.tmp'
mv -T -- '$@.tmp' '$@'
2018-08-12 02:26:38 +00:00
${WORKDIR}/build-232/build.log: %/build.log: %/build.raw
./osi-shell '$<' <<-'EOF' |& tee '$@.tmp'
2018-08-15 01:15:21 +00:00
su testuser || exit
set -e
2018-08-10 00:22:41 +00:00
cd ~/packages/abs/systemd
sudo librechroot sync # on rebuild the downgrade in [repo] will confuse chcleanup
sudo libremakepkg
2018-08-10 00:22:41 +00:00
EOF
2018-08-13 04:35:44 +00:00
mv -T -- '$@.tmp' '$@'
touch -- '$@'
2018-08-12 02:26:38 +00:00
2018-08-12 21:56:54 +00:00
# build the code under test
${WORKDIR}/build-$(COMMIT)/build.raw: ${WORKDIR}/build.raw
2018-08-12 22:49:35 +00:00
${WORKDIR}/build-$(COMMIT)/build.raw: osi-mk.d/testuser.sh
2018-08-12 02:26:38 +00:00
${WORKDIR}/build-$(COMMIT)/build.raw: abs/systemd $(wildcard abs/systemd/*)
${WORKDIR}/build-$(COMMIT)/build.raw: | ${WORKDIR}/systemd.git
${WORKDIR}/build-$(COMMIT)/build.raw: | ${WORKDIR}/.COMMIT.mk
2018-08-13 04:35:44 +00:00
rm -f -- '$@' '$@.tmp'
2018-08-12 02:26:38 +00:00
mkdir -p -- '$(@D)'
2018-08-10 00:22:41 +00:00
./osi-mk \
--edit='$(filter %.raw,$^)' \
2018-08-16 05:48:21 +00:00
--size=4G \
2018-08-12 21:56:54 +00:00
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
2018-08-12 22:16:27 +00:00
--directory='${WORKDIR}/systemd.git:/home/testuser/packages/srcdest/systemd' \
--directory='abs/systemd:/home/testuser/packages/abs/systemd' \
2018-08-13 04:35:44 +00:00
'$@.tmp'
mv -T -- '$@.tmp' '$@'
2018-08-12 02:26:38 +00:00
${WORKDIR}/build-$(COMMIT)/build.log: %/build.log: %/build.raw
./osi-shell '$<' <<-'EOF' |& tee '$@.tmp'
2018-08-15 01:15:21 +00:00
su testuser || exit
set -e
2018-08-06 00:09:42 +00:00
cd ~/packages/abs/systemd
sed 's:@COMMIT@:${COMMIT}:' < PKGBUILD.in > PKGBUILD
sudo libremakepkg
2018-08-06 00:09:42 +00:00
EOF
2018-08-13 04:35:44 +00:00
mv -T -- '$@.tmp' '$@'
touch -- '$@'
2018-08-12 02:26:38 +00:00
%/pkgdest: %/build.log
rm -rf -- '$@'
./osi-extract '$*/build.raw' /home/testuser/packages/pkgdest '$@'
2018-08-12 23:18:05 +00:00
test -d '$@'
touch '$@'
# tests ########################################################################
%/sd-tests.raw: %/build.raw %/build.log
rm -f -- '$@' '$@.tmp'
./osi-mk \
--edit='$(filter %.raw,$^)' \
--package=base-devel \
'$@.tmp'
./osi-shell '$@.tmp' <<-'EOF'
bsdtar xfO /home/testuser/packages/srcpkgdest/systemd-*.src.tar.gz systemd/.SRCINFO |
sed -nE -e 's/^\s+(|make|check)depends(|_\S*) = //p' -e '/^\s*pkgname/q' |
xargs pacman -S --needed --noconfirm --
EOF
mv -T -- '$@.tmp' '$@'
%/sd-tests-integration.raw: %/sd-tests.raw
rm -f -- '$@' '$@.tmp'
./osi-mk \
--edit='$(filter %.raw,$^)' \
--size=10G \
--package=qemu \
--package=net-tools \
--package=dhclient \
--package=strace \
2018-08-17 01:50:05 +00:00
--package=openbsd-netcat \
--package=busybox \
2018-08-17 17:04:18 +00:00
--package=plymouth \
'$@.tmp'
mv -T -- '$@.tmp' '$@'
%/sd-tests-integration.log: %/sd-tests-integration.raw
2018-08-16 21:20:19 +00:00
./osi-shell -- '$<' -m 1024 <<-'EOF' |& tee '$@.tmp'
set -e
mkdir -p /build
mount --bind /var/lib/archbuild/default/testuser/build /build
export BUILD_DIR=/build/systemd/src/build
export KERNEL_BIN=/boot/vmlinuz-linux-libre
2018-08-17 00:23:35 +00:00
export INITRD=/boot/initramfs-linux-libre-fallback.img
2018-08-17 15:21:45 +00:00
sed -i /SKIP_INITRD=yes/d /build/systemd/src/systemd/test/TEST-*/test.sh # Parabola (& Debian) kernels don't support SKIP_INITRD
cd /build/systemd/src/systemd
2018-08-17 15:21:45 +00:00
./test/run-integration-tests.sh setup run clean </dev/null
EOF
mv -T -- '$@.tmp' '$@'
touch -- '$@'
%/sd-tests-unit.raw: %/sd-tests.raw
rm -f -- '$@' '$@.tmp'
./osi-mk \
--edit='$(filter %.raw,$^)' \
--size=5G \
2018-08-17 21:18:01 +00:00
--package=python-pyparsing \
'$@.tmp'
mv -T -- '$@.tmp' '$@'
%/sd-tests-unit.log: %/sd-tests-unit.raw
./osi-shell '$<' <<-'EOF' |& tee '$@.tmp'
set -e
mkdir -p /build
mount --bind /var/lib/archbuild/default/testuser/build /build
su testuser
set -e
cd /build/systemd/src/build
meson configure -Dtests=unsafe -Dslow-tests=true
2018-08-17 18:59:13 +00:00
ninja
exit
2018-08-17 18:59:13 +00:00
ninja -C /build/systemd/src/build test
EOF
mv -T -- '$@.tmp' '$@'
touch -- '$@'