1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
| | # SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2023-2024 Alyssa Ross <hi@alyssa.is>
import ../../lib/call-package.nix (
{ callSpectrumPackage, rootfs, lib, testers, path }:
lib.fix (self: testers.nixosTest ({ pkgs, stdenv, ... }:
let
initramfs = callSpectrumPackage ../../host/initramfs {};
inherit (import (path + /nixos/lib/qemu-common.nix) { inherit lib pkgs; })
qemuBinary qemuSerialDevice;
in {
name = "spectrum-test-initramfs-no-roothash";
nodes = {};
testScript = ''
import shlex
flags = "${qemuBinary self.config.qemu.package} " + " ".join(map(shlex.quote, [
"-m", "512",
"-kernel", "${rootfs.kernel}/${stdenv.hostPlatform.linux-kernel.target}",
"-initrd", "${initramfs}",
"-append", "console=${qemuSerialDevice} panic=-1",
]))
machine = create_machine(flags)
machine.start()
machine.wait_for_console_text("roothash invalid or missing")
'';
}))) (_: {})
|