liminix/tests/tftpboot/test.nix

48 lines
1 KiB
Nix
Raw Normal View History

2023-12-18 23:42:29 +01:00
{
liminix
}:
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;
2023-12-18 23:42:29 +01:00
in pkgsBuild.runCommand "check" {
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;
};
2023-12-19 13:12:12 +01:00
}