Commit graph

207 commits

Author SHA1 Message Date
Daan De Meyer 14aea4a9f5 mkosi: Disable iscsi service and socket
We'll always start these on demand in integration tests that need
them. No need to start them by default.
2024-05-29 14:10:50 +02:00
Daan De Meyer 3c367df7c6 mkosi: Switch from btrfs to ext4
Mounting multiple btrfs filesystems with the same fsid only works
properly from kernel 6.7 onwards. Let's switch to ext4 for now which
does support this.
2024-05-29 14:10:50 +02:00
Daan De Meyer 6448993a4b mkosi: Set EXTRA_CFLAGS on opensuse
The opensuse spec doesn't unconditionally set FORTIFY_SOURCE=2 anymore
so let's drop our workaround.
2024-05-29 11:26:06 +02:00
Luca Boccassi 386dc7d0fd mkosi: explicitly install g++ in opensuse
Not pulled in by default at build time
2024-05-21 19:07:39 +01:00
Yu Watanabe 90fe8cf209 test: install more kernel modules for Fedora image
Otherwise, several tests for networkd are skipped.

Follow-up for #32666.
2024-05-20 18:38:45 +09:00
Daan De Meyer e182c7b4db test: Enable TEST-69-SHUTDOWN for mkosi
In mkosi, we run the test inside the VM instead of outside. To simplify
the implementation we drop the reboot part and only verify that we can
schedule and cancel shutdowns and that the wall messages are sent as
expected.
2024-05-16 18:21:32 +02:00
Daan De Meyer 4ac46561e9 test: Enable TEST-24-CRYPTSETUP for mkosi
Encrypted /var is skipped because meson's limitations make per test
images not really feasible and we can't encrypt /var by default because
it slows down the image build too much.

Co-authored-by: Richard Maw <richard.maw@codethink.co.uk>
2024-05-16 14:46:37 +02:00
Daan De Meyer b13b7978e7 test: Enable TEST-08-INITRD on mkosi 2024-05-15 10:09:53 +02:00
Daan De Meyer 985ea31173
Merge pull request #32666 from DaanDeMeyer/mkosi-network
test: Add TEST-85-NETWORK to run systemd-networkd-tests.py
2024-05-15 07:30:04 +02:00
Daan De Meyer 9e262ef92e test: Enable TEST-54-CREDS on mkosi 2024-05-14 23:19:28 +02:00
Daan De Meyer 16585dbaf4 mkosi: Disable journald rate-limiting 2024-05-14 22:58:28 +02:00
Daan De Meyer 5692f87160 test: Run TEST-64-UDEV-STORAGE with mkosi
We add a configure script for each subtest to add the required
qemu arguments.

Co-authored-by: Richard Maw <richard.maw@codethink.co.uk>
2024-05-14 12:43:28 +02:00
Daan De Meyer eb4c962aa4 test: Ignore configure scripts in minimal images
These are always aimed at the system image so ignore any specified
configure scripts in the minimal images.
2024-05-14 12:43:28 +02:00
Daan De Meyer f6af2976aa TEST-06-SELINUX: Simplify auto-relabeling
Let's ship a .autorelabel file so we can get rid of
firstboot-autorelabel.service.
2024-05-14 12:43:28 +02:00
Daan De Meyer 7a321b5a21 test: Rename testsuite-XX units to match test name
Having these named differently than the test itself mostly creates
unecessary confusion and makes writing logic against the tests harder
so let's rename the testsuite-xx units and scripts to just use the
test name itself.
2024-05-14 12:43:28 +02:00
Daan De Meyer 8f59b036de mkosi: Install dhcp-server on OpenSUSE
Required for systemd-networkd-tests.py.
2024-05-06 20:21:32 +02:00
Daan De Meyer 2c5dc1df1d mkosi: Install python3-psutil
Required to run systemd-networkd-tests.py. Already a dependency of
systemd-tests on Fedora so we don't add it there as it'll be pulled
in via the prepare script.
2024-05-06 18:15:54 +02:00
Daan De Meyer 15526060cc mkosi: Install radvd
Required for networkd integration tests.
2024-05-06 18:15:54 +02:00
Daan De Meyer fdf3820e54 mkosi: Configure coredump to store coredumps in the journal.
Makes it easier to debug coredumps that happen in CI as we can retrieve
them via the journal.
2024-05-06 14:44:43 +02:00
Daan De Meyer 71b7156bd3 mkosi: Add missing SPDX line 2024-05-06 14:44:27 +02:00
Daan De Meyer 21e9282bc2 mkosi: Only look for services in /usr and /etc 2024-05-06 14:40:29 +02:00
Daan De Meyer bda54ae03f mkosi: Skip build if NO_BUILD is set
This allows running the integration tests against the distro's packaged
version of systemd.
2024-05-06 14:40:26 +02:00
Daan De Meyer fc4bac8162 mkosi: Add dependency to system image on minimal-base
The output is included as an extra tree so it should be a dependency,
even if it is pulled in transitively via minimal-0 and minimal-1
already.
2024-05-06 10:56:45 +02:00
Daan De Meyer 13686c0e58 mkosi: Install dbus policy required by TEST-23-UNIT-FILE
Co-authored-by: Richard Maw <richard.maw@codethink.co.uk>
2024-05-06 10:56:45 +02:00
Daan De Meyer 6817910e6f mkosi: Remove /etc/default/keyboard if it exists
Required to make TEST-73-LOCALE pass on Ubuntu.
2024-05-06 10:56:45 +02:00
Daan De Meyer 7cf0efd8ec mkosi: Make sure tmp.mount is not messed with on Debian/Ubuntu
We want /tmp to be a tmpfs so let's hack the debian packaging to
make sure that's the case until the debian packaging is fixed to
make /tmp a tmpfs for UPSTREAM=1 builds.
2024-05-06 10:56:45 +02:00
Daan De Meyer 5cb66ff5a1 mkosi: Install stress
Required for TEST-55-OOMD. Not available on opensuse.
2024-05-06 10:56:45 +02:00
Daan De Meyer 3c3e21fb64 mkosi: Install veritysetup
Only missing on CentOS/Fedora/OpenSUSE as in Arch/Debian/Ubuntu it's
part of the cryptsetup package which we already install.

Required for TEST-58-REPART.
2024-05-06 10:56:45 +02:00
Daan De Meyer a82d897c3d mkosi: Install dig
Required for TEST-75-RESOLVED
2024-05-06 10:56:45 +02:00
Daan De Meyer 2d93e534a3 mkosi: Install knot
Required for TEST-75-RESOLVED
2024-05-06 10:56:45 +02:00
Daan De Meyer efbd22e476 mkosi: Use /etc/nsswitch.conf from repo in mkosi image 2024-05-06 10:56:45 +02:00
Daan De Meyer f09947661c mkosi: Move sbsigntools to CentOS/Fedora shared configuration
sbsigntools was added to EPEL 9.
2024-05-06 10:56:45 +02:00
Daan De Meyer 9bf888faf1 mkosi: Drop glibc-langpack-en from Fedora specific packages
It's already added in the CentOS/Fedora shared configuration.
2024-05-06 10:56:45 +02:00
Daan De Meyer 89255c31a4 mkosi: Install dfuzzer on CentOS/Fedora images
Required for TEST-21-DFUZZER.
2024-05-06 10:56:45 +02:00
Richard Maw e26efe09f3 mkosi: Disable selinux labelling and install policy in initramfs
It is necessary to install the selinux policy in the initramfs
so that userland is entered with the correct label.

SELinuxRelabel defaults to auto, which will skip if the relabelling
command is not installed and will treat failure to relabel as non-fatal.

We can't force it on because root privileges are required if the labels
don't exist on the host system and we would like to be able to
cross-build from other distributions.

Since we are already committed to relabelling on first boot
there is no value in even trying to label.
2024-05-03 12:57:11 +01:00
Richard Maw a56820d16a mkosi: Fix particle profile
The sbsign and ukify part was moved into a finalize script
rather than a postinst.chroot script so was using host tools
instead of just-built.
2024-05-03 13:49:09 +02:00
Daan De Meyer f991c3871b mkosi: Fix %__check_files eval in opensuse build script
Make sure the correct buildroot gets expanded instead of the default
opensuse build root location.

We also remove debug files from the unpackaged files list as they're
handled separately by rpm.
2024-04-30 18:17:11 +02:00
Daan De Meyer 3c9a807ac8 mkosi: Install more locales on CentOS/Fedora
Required for TEST-73-LOCALE.
2024-04-30 17:01:41 +02:00
Daan De Meyer 0d73e224e2 mkosi: Install tpm2-tools in system image
Required for TEST-70-TPM2.
2024-04-30 17:01:41 +02:00
Daan De Meyer 695ebbaf7f mkosi: Override /sbin/init in minimal-base
Required for TEST-13-NSPAWN.
2024-04-30 17:01:41 +02:00
Richard Maw 334e707329 mkosi: Add curl package for journal tests 2024-04-30 17:01:41 +02:00
Daan De Meyer 989d46df8b mkosi: Install locales on debian/ubuntu
Required for TEST-73-LOCALE.
2024-04-30 17:01:41 +02:00
Daan De Meyer a531931cd4 mkosi: Simply remove all the debian patches instead of mounting over them
The build sources are ephemeral anyways, so we can just remove the patches
instead of hiding them.
2024-04-30 17:01:41 +02:00
Daan De Meyer e839cb1cf8 mkosi: Use symlinks instead of bind mounts for Arch
With bind mounts, the directories we bind mount to get recorded as
the meson source and build directories. This means meson will complain
if we later try to run meson install -C /work/build in the virtual
machine or container. If we use symlinks, the directories we symlink to
will be recorded as the meson source and build directories, which means
meson install -C /work/build will work when executed after booting the
VM or container.

I tried to do the same for debian as well but the debian package tooling
changes directory into the build directory and then does meson setup ..
which is completely broken when switching to a symlink.
2024-04-30 17:01:41 +02:00
Daan De Meyer 48e0399bee mkosi: Install minimal-base to /usr/share/testsuite-13-container-template
Required for TEST-13-NSPAWN.
2024-04-30 17:01:41 +02:00
Daan De Meyer a8bc9400a8 mkosi: Remove more files from Arch minimal image 2024-04-30 17:01:41 +02:00
Daan De Meyer c89244842b test: Don't persist journal in mkosi image if we're not debugging tests
If we're not debugging tests, there's no point in persisting the journal,
so let's use the volatile journal storage mode in that case to avoid doing
unnecessary work.

We don't disable journal storage alltogether since various tests check
that stuff is written to the journal.
2024-04-30 15:20:55 +02:00
Daan De Meyer 742b77e1d2 mkosi: Make sure we create an image without /var/log/journal
This allows journald to create the directory itself with the right
chattr settings on first boot.
2024-04-30 11:41:02 +02:00
Daan De Meyer 744fe45b8f mkosi: Simplify rpm build scripts 2024-04-30 11:39:36 +02:00
Daan De Meyer e7c8507977 mkosi: Introduce particle profile
Unfortunately the current mkosi partitioning setup is a bit too
avant-garde for the integration tests. Both in that distributions
aren't ready for it yet (some more than others), and that software
which we depend on in the integration tests isn't ready for it yet
(e.g. libselinux does not read its configuration from /usr).

Let's switch back to a more boring partioning setup by default but
keep the fancy stuff around as a mkosi profile. This means that it
can still be used for manually testing stuff by running
"mkosi --profile particle -f qemu".
2024-04-30 10:46:18 +02:00
Daan De Meyer b2173f50dc mkosi: Ignore version from versioned dependencies in .SRCINFO
Dependencies in .SRCINFO can be versioned. Let's make sure we ignore
any specified versions when grepping it for dependencies. Also update
the arch submodule to the latest to make sure the change works.
2024-04-28 16:20:58 +02:00
Richard Maw 6e40124efb mkosi: use generic ubuntu kernel for udev and nvme tests
TEST-17-UDEV expects to find scsi_debug and TEST-84-STORAGETM expects to
find nvmet-tcp.

This isn't ideal as it adds firmware, microcode and other drivers to the
initramfs, but there's no linux-modules-extra virtual package
to just include the extra modules.
2024-04-26 15:55:42 +01:00
Richard Maw 9750972455 mkosi: Use default opensuse kernel for tests
The kvmsmall kernel lacks important modules like the dummy network
device which TEST-17-UDEV requires very early on.
2024-04-26 15:55:42 +01:00
Daan De Meyer e392c868d2 mkosi: Set CleanPackageMetadata=yes for minimal-base
We don't want to install any more packages in derived images so let's
not store repository metadata in the image to make it smaller.
2024-04-26 13:46:45 +02:00
Daan De Meyer c77dad706b mkosi: Build minimal images and enable related integration tests
This commit adds definitions to build the minimal_0 and minimal_1
images with mkosi and includes them into the system image. We also
move the building of the various app-xxx and similar images that are
extremely minimal into the tests itself by moving the related logic
from install_verity_minimal() into a new function
install_extension_images() in util.sh. Because the mkosi /usr is
read-only, we now place the extension images in /tmp instead of
/usr/share.

Co-authored-by: Richard Maw <richard.maw@codethink.co.uk>
Co-authored-by: sam-leonard-ct <sam.leonard@codethink.co.uk>
2024-04-25 21:06:30 +02:00
Daan De Meyer d74ebb175a mkosi: Make sure systemd-resolved is started on boot 2024-04-25 17:06:42 +02:00
Daan De Meyer a721b93aaa mkosi: Add squashfs-tools
Required for various integration tests.
2024-04-25 17:06:00 +02:00
Daan De Meyer 2c139de254 mkosi: Add attr
Required for messing around with xattrs in integration tests.
2024-04-24 12:09:12 +02:00
Daan De Meyer ab7253e1ec mkosi: Add nvme-cli
The nvme command is needed for TEST-84-STORAGETM.
2024-04-24 11:02:48 +02:00
Richard Maw fab270d73e mkosi: Add psmisc to opensuse for killall 2024-04-24 11:01:45 +02:00
Richard Maw f744ccd5fe mkosi: Add psmisc to debian-ubuntu for killall 2024-04-24 11:01:45 +02:00
Richard Maw bad25450b8 mkosi: Add psmisc to arch for killall 2024-04-24 11:01:45 +02:00
Daan De Meyer 622678edd7
Merge pull request #32352 from DaanDeMeyer/test
test: Various mkosi integration test improvements
2024-04-23 11:27:23 +02:00
Daan De Meyer 422124072d mkosi: Run integration tests in CI
We do the image build and run the tests in a btrfs loopback so we
can make use of btrfs subvolumes and COW to keep the disk space
requirements to a minimum and speed up the ephemeral copies we make
of the image to run the tests.

We also switch to building debug packages and publishing the built
packages as artifacts.
2024-04-23 10:33:08 +02:00
Daan De Meyer 89b44cbb4d mkosi: Deal with ubuntu's special debug packages
Building debug packages on ubuntu requires the "debug" option to be
specified explicitly. Debug packages on Ubuntu have the .ddeb extension,
so let's make sure we handle that by copying the .ddeb packages in the
build script as well.
2024-04-23 10:25:02 +02:00
Daan De Meyer 388dcc785b mkosi: Use -fdebug-prefix-map= instead of -ffile-prefix-map=
-ffile-prefix-map= implies -fmacro-prefix-map= which is incompatible
with our definition of PROJECT_FILE.

See https://github.com/systemd/systemd/issues/32417.

-fdebug-prefix-map= only affects debuginfo without affecting macros.
2024-04-23 10:25:02 +02:00
Luca Boccassi 41fb4dc334 mkosi: mask isc-dhcp-server
isc-dhcp-server does not ship units, only sysv scripts, so the mkosi
presets that disable it have no effect. The generated unit is started on
each boot and fails, causing delays and noise.

Mask it so that the generated unit is overridden. It is installed only
to bring in binaries used by the networkd tests anyway.
2024-04-23 07:04:27 +02:00
Daan De Meyer e888d1cae8 mkosi: Drop workaround to re-enable serial console line wrapping
Since we do it in reset_terminal_fd() now, there's no need to carry
this workaround anymore.
2024-04-22 15:28:26 +02:00
Daan De Meyer 8308fcfec3 mkosi: Explicitly disable fortify for debian/ubuntu
We do the same for the other distributions, so let's do so for
debian/ubuntu as well.
2024-04-22 10:49:32 +02:00
Daan De Meyer 4ccc28b8a8 mkosi: Use awk to avoid dpkg-buildpackage warning
Let's strip unnecessary whitespace to avoid a dpkg-buildpackage
warning.
2024-04-22 10:48:52 +02:00
Daan De Meyer 4de750ce90 mkosi: Add environment variable to set the optimization level 2024-04-22 10:29:21 +02:00
Daan De Meyer fa15d444be mkosi: Install various system users/groups in opensuse images
These don't get pulled in automatically and there doesn't seem to
be a "system-users" package so install the ones we need for the
integration tests manually.
2024-04-22 09:09:32 +02:00
Daan De Meyer 9fd52adacf mkosi: Backport Fedora basic users/groups sysusers files to CentOS
CentOS does not ship these sysusers dropins which set up basic system
users and groups. Until we can move to CentOS Stream 10, let's add the
dropins ourselves to make sure the base system users/groups are available
on CentOS.
2024-04-22 09:09:32 +02:00
Daan De Meyer 245387721b mkosi: Install procps-ng in all images
Required for TEST-01-BASIC.
2024-04-22 09:09:32 +02:00
Daan De Meyer 4edc85a6c9 mkosi: Make sure systemd-libs is updated on Arch
The Arch Linux PKGBUILD does not (yet) have versioned dependencies
between the systemd packages, causing systemd-libs to not get updated
to 256-devel if systemd 256-devel is installed. Let's explicitly install
the newer version of systemd-libs as well for now until this problem is
fixed.
2024-04-22 09:09:32 +02:00
Daan De Meyer 27e7b633bb mkosi: Make sure ping is installed
Required for test-bpf-firewall.
2024-04-22 09:09:32 +02:00
Daan De Meyer 865f67701c mkosi: Disable rpm package notes
This introduces dependencies on various environment variables set
by rpmbuild which will not be set when rerunning meson inside the
VM/container so let's disable package notes to avoid these dependencies,
as the package notes aren't terribly useful in this scenario anyway.
2024-04-22 09:09:32 +02:00
Daan De Meyer 1531413efa mkosi: Make sure serial console line wrapping is re-enabled 2024-04-22 09:09:30 +02:00
Daan De Meyer a2574ebf4d mkosi: Fix FORTIFY_SOURCE (again)
CentOS/Fedora use annobin which will complain if FORTIFY_SOURCE=0
is used so we disable those checks to avoid the warnings.

We also make sure that when we query the compilation flags so we can
add more, we set _fortify_level=0 and undefine _lto_flags so that we
don't get those flags in the result.
2024-04-19 10:17:09 +02:00
Richard Maw 945b722f13 test: Add mkosi-based integration test runner
The first two tests are included to ensure parallel test execution is
demonstrable.
2024-04-18 16:26:38 +01:00
Daan De Meyer 6c07705213 mkosi: undefine FORTIFY_SOURCE instead of setting it zero
Newer gcc complains if FORTIFY_SOURCE=0 is set so just undefine it
instead.
2024-04-18 14:35:07 +02:00
Daan De Meyer 104c64fae1 mkosi: Disable bash debugging in Arch build script 2024-04-18 14:21:31 +02:00
Daan De Meyer a432014b01 mkosi: Install debug packages when WITH_DEBUG=1 is enabled
When we're building debuginfo packages, the original binaries and
libraries are stripped so make sure we install the debuginfo
packages to make sure debugging in the container/VM still works.
2024-04-18 14:01:50 +02:00
Daan De Meyer 35c1ea4d69 mkosi: Setup --ffile-prefix-map= for opensuse as well
This doesn't actually work because the opensuse spec doesn't allow
adding extra build flags, but I'm working on fixing that, so let's
already set things up for later.
2024-04-18 14:01:44 +02:00
Daan De Meyer 15bf8bfb69 mkosi: Undefine FORTIFY_SOURCE before setting it again
Otherwise we get warnings from gcc.
2024-04-18 14:01:06 +02:00
Daan De Meyer d2c0acaf70 mkosi: Install more packages
Let's install everything we can to get more coverage and make sure
all build outputs are available in mkosi containers or VMs.
2024-04-18 13:32:43 +02:00
Daan De Meyer 6911a9ea7f mkosi: Drop systemd-repart from package lists
This is just a Provides for systemd-udev.
2024-04-18 13:27:05 +02:00
Daan De Meyer 22fa7cbccc mkosi: Drop workarounds
With the latest Github Actions image release none of these should
be required anymore (20240414.1.1).
2024-04-17 17:36:36 +02:00
Daan De Meyer 241d792c92 mkosi: Switch to O0 and disable FORTIFY_SOURCE
-Og still causes a lot of "<optimized out>" in GDB so let's use -O0
instead and disable FORTIFY_SOURCE as it doesn't work without
optimizations enabled.
2024-04-17 17:36:33 +02:00
Daan De Meyer 42ca6c2773 mkosi: Disable DWARF debug info optimization
We care more about fast builds in this case so disable the DWARF
debug optimization that's done by default.
2024-04-17 16:11:35 +02:00
Daan De Meyer 7f1d7fed80 mkosi: Override build_cflags instead of _distro_extra_cflags
The latter is not supported on CentOS Stream 9.
2024-04-17 15:38:24 +02:00
Daan De Meyer 8e728c14ec mkosi: Set up -ffile-prefix-map= correctly when building debuginfo packages
This makes sure that the debuginfo files contain source files pointing
to the source files shipped by the debugsource package.

Normally this should be done automatically by rpm invoking debugedit
but for some unknown reason debugedit refuses to rewrite the source
files in our binaries.

Given that debugedit is completely undebugable (does not generate any
logs at all, and its source code is ridiculously obtuse), let's set
-ffile-prefix-map= when building instead which achieves the same
effect.
2024-04-17 15:21:01 +02:00
Daan De Meyer 4980ae0fbc mkosi: Add support for building debug packages
This allows building debug packages by setting WITH_DEBUG=1. This
slows down the build a lot so it's opt in. We don't yet install
these but can do so in a future commit.
2024-04-16 15:25:37 +02:00
Daan De Meyer f1884281a0 mkosi: Add --noclean when running rpmbuild
The entire build environment is ephemeral anyway so everything is
cleaned regardless. By specifying --noclean, we make debugging
easier as the rpm build root can be inspected when using --debug-shell.
2024-04-16 15:25:37 +02:00
Daan De Meyer 2400b3a590 mkosi: Install which in image
gdb-headless in Fedora is missing a dependency on which:
https://bugzilla.redhat.com/show_bug.cgi?id=2275274

This happens all the time so let's make sure which is always installed
in the image.
2024-04-16 15:25:37 +02:00
Daan De Meyer 9d98617c1a Update debugging with vscode section
- We have ssh-generator now, so need for mkosi's Ssh= option anymore.
- By enabling RuntimeBuildSources= by default, we don't need the gdb
  config file in the image anymore, since the build and source
  directories will be mounted at the expected locations.
2024-04-16 15:25:34 +02:00
Daan De Meyer 9c5216bb9d mkosi: Use new volatile package settings
mkosi just learned to do natively what we currently do with environment
variables and a postinst script, so let's update to the latest version
and start using the new settings instead.
2024-04-14 19:53:43 +02:00
Daan De Meyer 035bdb1472 mkosi; Fix permissions of mkosi.postinst script
Must be executable.
2024-04-09 16:20:58 +01:00
Daan De Meyer 07d52c7a46 mkosi: Drop out-of-date comment 2024-04-09 11:57:38 +02:00
Daan De Meyer 1a2374a3f6 mkosi: Unify initrd post-install scripts
Just like we already have $SYSTEMD_PACKAGES for systemd packages to
re-install in the main image, let's add $INITRD_PACKAGES for all
systemd packages to re-install in the initrd.
2024-04-09 11:57:16 +02:00