liminix/tests/tftpboot/test.nix

48 lines
1.1 KiB
Nix
Raw Normal View History

2023-12-18 22:42:29 +00:00
{
liminix
}:
let check = deviceName : ubootName : config :
2023-12-18 22:42:29 +00:00
let derivation = (import liminix {
2023-12-19 12:12:12 +00:00
device = import "${liminix}/devices/${deviceName}/";
liminix-config = { pkgs, ... } : {
imports = [./configuration.nix];
inherit config;
};
2023-12-18 22:42:29 +00:00
});
img = derivation.outputs.tftpboot;
2023-12-19 12:12:12 +00:00
uboot = derivation.pkgs.${ubootName};
pkgsBuild = derivation.pkgs.pkgsBuildBuild;
2023-12-18 22:42:29 +00:00
in pkgsBuild.runCommand "check" {
nativeBuildInputs = with pkgsBuild; [
expect
socat
run-liminix-vm
] ;
} ''
mkdir vm
ln -s ${img} result
2023-12-19 12:12:12 +00:00
2023-12-22 23:20:35 +00:00
touch empty empty2
2023-12-18 22:42:29 +00:00
run-liminix-vm \
--background ./vm \
2023-12-19 12:12:12 +00:00
--u-boot ${uboot}/u-boot.bin \
--arch ${derivation.pkgs.stdenv.hostPlatform.qemuArch} \
--wan "user,tftp=`pwd`" \
2023-12-22 23:20:35 +00:00
--disk-image empty2 \
empty empty2
2023-12-18 22:42:29 +00:00
expect ${./script.expect} 2>&1 |tee $out
2023-12-19 12:12:12 +00:00
'';
in {
aarch64 = check "qemu-aarch64" "ubootQemuAarch64" {};
arm = check "qemu-armv7l" "ubootQemuArm" {};
armZimage = check "qemu-armv7l" "ubootQemuArm" {
boot.tftp.kernelFormat = "zimage";
};
mips = check "qemu" "ubootQemuMips" {};
2023-12-22 23:20:35 +00:00
mipsLz = check "qemu" "ubootQemuMips" {
boot.tftp.compressRoot = true;
};
2023-12-19 12:12:12 +00:00
}