liminix/tests/tftpboot/test.nix

56 lines
1.3 KiB
Nix
Raw Normal View History

2023-12-18 23:42:29 +01:00
{
2024-09-18 09:10:07 +02:00
liminix,
...
2023-12-18 23:42:29 +01:00
}:
2023-12-29 18:07:47 +01:00
let check = deviceName : config :
2023-12-18 23:42:29 +01:00
let derivation = (import liminix {
2023-12-19 13:12:12 +01:00
device = import "${liminix}/devices/${deviceName}/";
liminix-config = { pkgs, ... } : {
imports = [./configuration.nix];
inherit config;
};
2023-12-18 23:42:29 +01:00
});
img = derivation.outputs.tftpboot;
2023-12-29 18:07:47 +01:00
uboot = derivation.outputs.u-boot;
2023-12-19 13:12:12 +01:00
pkgsBuild = derivation.pkgs.pkgsBuildBuild;
in pkgsBuild.runCommand "check-${deviceName}" {
2023-12-18 23:42:29 +01:00
nativeBuildInputs = with pkgsBuild; [
expect
socat
run-liminix-vm
] ;
} ''
mkdir vm
ln -s ${img} result
2023-12-19 13:12:12 +01:00
2023-12-23 00:20:35 +01:00
touch empty empty2
2023-12-18 23:42:29 +01:00
run-liminix-vm \
--background ./vm \
2023-12-19 13:12:12 +01:00
--u-boot ${uboot}/u-boot.bin \
--arch ${derivation.pkgs.stdenv.hostPlatform.qemuArch} \
--wan "user,tftp=`pwd`" \
2023-12-23 00:20:35 +01:00
--disk-image empty2 \
empty empty2
2023-12-18 23:42:29 +01:00
expect ${./script.expect} 2>&1 |tee $out
2023-12-19 13:12:12 +01:00
'';
in {
2023-12-29 18:07:47 +01:00
aarch64 = check "qemu-aarch64" {};
arm = check "qemu-armv7l" {};
armZimage = check "qemu-armv7l" {
boot.tftp.kernelFormat = "zimage";
};
2023-12-29 18:07:47 +01:00
mips = check "qemu" {};
mipsLz = check "qemu" {
2023-12-23 00:20:35 +01:00
boot.tftp.compressRoot = true;
};
# this works on real hardware but I haven't figured out how
# to make it work on qemu: it says
# "OF: fdt: No chosen node found, continuing without"
# mipsOldUboot = check "qemu" {
# boot.tftp.appendDTB = true;
# };
2023-12-19 13:12:12 +01:00
}