aboutsummaryrefslogtreecommitdiffstats
path: root/tests/qemu/debug.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-21 16:17:35 +0000
committertv <tv@krebsco.de>2026-11-25 22:53:22 +0100
commit595f6e3f69702aa50f17d37eb49d9050257307a0 (patch)
treefdd2a8ffe357e7dd425a564193c024d7abb089ec /tests/qemu/debug.nix
parentfe46f7703e6145af9d3c9eb43d6ded19b316c83c (diff)
tests: the run script in qemu, and a NixOS VM test of modules/host
Both were only in the sandbox the project was developed in so far. tests/qemu builds the run script with a qemu stand-in for Firecracker (same kernel, initrd, drives, vsock via vhost-device-vsock; network via qemu's user networking, the guest's port 22 on 127.0.0.1:2222) and a test layer running a script at the end of boot, its output on the console. The run script still takes a tap, so it needs modules/host where it runs. tests/vm-host.nix is a NixOS VM test of modules/host, with network namespaces on veths in place of taps as guests: a VM's static address by name, tcp:// rules over IPv4 and IPv6 and by name, DNS, anti-spoofing, POST /check, the path units and the timer.
Diffstat (limited to 'tests/qemu/debug.nix')
-rw-r--r--tests/qemu/debug.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/qemu/debug.nix b/tests/qemu/debug.nix
new file mode 100644
index 0000000..a8790de
--- /dev/null
+++ b/tests/qemu/debug.nix
@@ -0,0 +1,18 @@
+# A layer for testing in qemu (see default.nix): a root shell script run
+# at the end of boot, whose output goes to the console (the test's
+# stdout). (virtio_pci, which qemu needs, is in the base system.)
+script: { pkgs, config, lib, ... }: {
+ systemd.services.fc-test = {
+ wantedBy = [ "multi-user.target" ];
+ after = [ "multi-user.target" ];
+ path = [ pkgs.util-linux pkgs.coreutils "/run/current-system/sw" ];
+ environment = lib.mkIf config.fc.nix {
+ NIX_REMOTE = "daemon";
+ NIX_PATH = "nixpkgs=/nixpkgs";
+ };
+ serviceConfig.StandardOutput = "tty";
+ serviceConfig.StandardError = "tty";
+ serviceConfig.TTYPath = "/dev/console";
+ inherit script;
+ };
+}