diff --git a/mkosi.conf b/mkosi.conf index 6977bd19e..cb9fe1308 100644 --- a/mkosi.conf +++ b/mkosi.conf @@ -35,7 +35,12 @@ RemoveFiles= /usr/lib/kernel/install.d/50-dracut.install # Make sure that SELinux doesn't run in enforcing mode even if it's pulled in as a dependency. -KernelCommandLine=enforcing=0 +KernelCommandLine= + enforcing=0 + systemd.log_ratelimit_kmsg=0 + systemd.crash_shell + printk.devkmsg=on + systemd.early_core_pattern=/core KernelModulesInitrdExclude=.* KernelModulesInitrdInclude=default diff --git a/tests/__init__.py b/tests/__init__.py index 75b475663..3900198a5 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -13,7 +13,6 @@ import pytest -from mkosi.config import finalize_term from mkosi.distributions import Distribution from mkosi.run import run from mkosi.types import _FILE, CompletedProcess, PathString @@ -58,18 +57,14 @@ def mkosi( check: bool = True, ) -> CompletedProcess: kcl = [ - f"TERM={finalize_term()}", "loglevel=6", - "systemd.crash_shell", "systemd.log_level=debug", "udev.log_level=info", - "systemd.log_ratelimit_kmsg=0", "systemd.show_status=false", "systemd.journald.forward_to_console", "systemd.journald.max_level_console=info", - "printk.devkmsg=on", - "systemd.early_core_pattern=/core", "systemd.firstboot=no", + "systemd.unit=mkosi-check-and-shutdown.service", ] return run([ @@ -83,12 +78,12 @@ def mkosi( else [] ), *(["--tools-tree-release", self.config.tools_tree_release] if self.config.tools_tree_release else []), + "--incremental", + "--ephemeral", + "--runtime-build-sources=no", *self.options, *options, "--output-dir", self.output_dir, - # Some tests ignore the default image config but we still want them to reuse the cache directory for the - # tools tree cache. - "--cache-dir", "mkosi.cache", *(f"--kernel-command-line={i}" for i in kcl), "--qemu-vsock=yes", # TODO: Drop once both Hyper-V bugs are fixed in Github Actions. diff --git a/tests/test_boot.py b/tests/test_boot.py index 3e4517831..fa245725a 100644 --- a/tests/test_boot.py +++ b/tests/test_boot.py @@ -26,14 +26,7 @@ def have_vmspawn() -> bool: @pytest.mark.parametrize("format", [f for f in OutputFormat if f not in (OutputFormat.confext, OutputFormat.sysext)]) def test_format(config: ImageConfig, format: OutputFormat) -> None: - with Image( - config, - options=[ - "--kernel-command-line=systemd.unit=mkosi-check-and-shutdown.service", - "--incremental", - "--ephemeral", - ], - ) as image: + with Image(config) as image: if image.config.distribution == Distribution.rhel_ubi and format in (OutputFormat.esp, OutputFormat.uki): pytest.skip("Cannot build RHEL-UBI images with format 'esp' or 'uki'") @@ -91,9 +84,6 @@ def test_bootloader(config: ImageConfig, bootloader: Bootloader) -> None: with Image( config, options=[ - "--kernel-command-line=systemd.unit=mkosi-check-and-shutdown.service", - "--incremental", - "--ephemeral", "--format=disk", "--bootloader", str(bootloader), "--qemu-firmware", str(firmware) diff --git a/tests/test_initrd.py b/tests/test_initrd.py index b07e2ae8c..59833fba2 100644 --- a/tests/test_initrd.py +++ b/tests/test_initrd.py @@ -35,15 +35,7 @@ def passphrase() -> Iterator[Path]: def test_initrd(config: ImageConfig) -> None: - with Image( - config, - options=[ - "--kernel-command-line=systemd.unit=mkosi-check-and-shutdown.service", - "--incremental", - "--ephemeral", - "--format=disk", - ] - ) as image: + with Image(config, options=["--format=disk"]) as image: image.build() image.qemu() @@ -53,13 +45,9 @@ def test_initrd_lvm(config: ImageConfig) -> None: with Image( config, options=[ - "--kernel-command-line=systemd.unit=mkosi-check-and-shutdown.service", # LVM confuses systemd-repart so we mask it for this test. "--kernel-command-line=systemd.mask=systemd-repart.service", "--kernel-command-line=root=LABEL=root", - "--kernel-command-line=rw", - "--incremental", - "--ephemeral", "--qemu-firmware=linux", ] ) as image, contextlib.ExitStack() as stack: @@ -142,10 +130,7 @@ def test_initrd_luks(config: ImageConfig, passphrase: Path) -> None: options=[ "--repart-dir", repartd, "--passphrase", passphrase, - "--kernel-command-line=systemd.unit=mkosi-check-and-shutdown.service", "--credential=cryptsetup.passphrase=mkosi", - "--incremental", - "--ephemeral", "--format=disk", ] ) as image: @@ -158,12 +143,8 @@ def test_initrd_luks_lvm(config: ImageConfig, passphrase: Path) -> None: with Image( config, options=[ - "--kernel-command-line=systemd.unit=mkosi-check-and-shutdown.service", "--kernel-command-line=root=LABEL=root", - "--kernel-command-line=rw", "--credential=cryptsetup.passphrase=mkosi", - "--incremental", - "--ephemeral", "--qemu-firmware=linux", ] ) as image, contextlib.ExitStack() as stack: @@ -215,10 +196,7 @@ def test_initrd_luks_lvm(config: ImageConfig, passphrase: Path) -> None: def test_initrd_size(config: ImageConfig) -> None: - with Image( - config, - options=["--incremental", "--format=directory"], - ) as image: + with Image(config) as image: image.build() # The fallback value is for CentOS and related distributions. diff --git a/tests/test_sysext.py b/tests/test_sysext.py index df33bd6ab..6b5cf244e 100644 --- a/tests/test_sysext.py +++ b/tests/test_sysext.py @@ -13,7 +13,6 @@ def test_sysext(config: ImageConfig) -> None: with Image( config, options=[ - "--incremental", "--clean-package-metadata=no", "--format=directory", ], @@ -24,6 +23,7 @@ def test_sysext(config: ImageConfig) -> None: image.config, options=[ "--directory", "", + "--incremental=no", "--base-tree", Path(image.output_dir) / "image", "--overlay", "--package=dnsmasq",