liminix/tests/tftpboot/test.nix

37 lines
887 B
Nix
Raw Normal View History

2023-12-18 23:42:29 +01:00
{
liminix
}:
2023-12-19 13:12:12 +01:00
let check = deviceName : ubootName :
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}/";
2023-12-18 23:42:29 +01:00
liminix-config = ./configuration.nix;
});
img = derivation.outputs.tftpboot;
2023-12-19 13:12:12 +01:00
uboot = derivation.pkgs.${ubootName};
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-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-18 23:42:29 +01:00
--disk-image result/rootfs \
result/uimage result/rootfs
expect ${./script.expect} 2>&1 |tee $out
2023-12-19 13:12:12 +01:00
'';
in {
aarch64 = check "qemu-aarch64" "ubootQemuAarch64";
2023-12-21 20:17:14 +01:00
arm = check "qemu-armv7l" "ubootQemuArm";
mips = check "qemu" "ubootQemuMips";
2023-12-19 13:12:12 +01:00
}