From dc8d92608d407c7f80a3cba8d4195aa1a0b7c36c Mon Sep 17 00:00:00 2001 From: Flo Date: Thu, 28 Nov 2024 13:50:44 +0100 Subject: [PATCH] Add tests --- nixos/tests/boot.nix | 55 ++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/nixos/tests/boot.nix b/nixos/tests/boot.nix index b73f9593e491..3ec8d3e5a3cf 100644 --- a/nixos/tests/boot.nix +++ b/nixos/tests/boot.nix @@ -111,34 +111,39 @@ let pxe = ipxeBootDir; } // extraConfig); in - makeTest { - name = "boot-netboot-" + name; - nodes = { }; - testScript = '' - machine = create_machine("${startCommand}") - machine.start() - machine.wait_for_unit("multi-user.target") - machine.shutdown() - ''; - }; -in { - uefiCdrom = makeBootTest "uefi-cdrom" { - uefi = true; - cdrom = "${iso}/iso/${iso.isoName}"; + makeTest { + name = "boot-netboot-" + name; + nodes = { }; + testScript = '' + machine = create_machine("${startCommand}") + machine.start() + machine.wait_for_unit("multi-user.target") + machine.succeed("grep 'serial' /proc/cmdline") + machine.succeed("grep 'live.nixos.passwordHash' /proc/cmdline") + machine.succeed("grep '$6$jnwR50SkbLYEq/Vp$wmggwioAkfmwuYqd5hIfatZWS/bO6hewzNIwIrWcgdh7k/fhUzZT29Vil3ioMo94sdji/nipbzwEpxecLZw0d0' /etc/shadow") + machine.shutdown() + ''; }; +in +{ + uefiCdrom = makeBootTest "uefi-cdrom" { + uefi = true; + cdrom = "${iso}/iso/${iso.isoName}"; + }; - uefiUsb = makeBootTest "uefi-usb" { - uefi = true; - usb = "${iso}/iso/${iso.isoName}"; - }; + uefiUsb = makeBootTest "uefi-usb" { + uefi = true; + usb = "${iso}/iso/${iso.isoName}"; + }; - uefiNetboot = makeNetbootTest "uefi" { - uefi = true; - }; -} // lib.optionalAttrs (pkgs.stdenv.hostPlatform.system == "x86_64-linux") { - biosCdrom = makeBootTest "bios-cdrom" { - cdrom = "${iso}/iso/${iso.isoName}"; - }; + uefiNetboot = makeNetbootTest "uefi" { + uefi = true; + }; +} +// lib.optionalAttrs (pkgs.stdenv.hostPlatform.system == "x86_64-linux") { + biosCdrom = makeBootTest "bios-cdrom" { + cdrom = "${iso}/iso/${iso.isoName}"; + }; biosUsb = makeBootTest "bios-usb" { usb = "${iso}/iso/${iso.isoName}";