test.nix (1304B)
1 { 2 liminix 3 }: 4 let check = deviceName : config : 5 let derivation = (import liminix { 6 device = import "${liminix}/devices/${deviceName}/"; 7 liminix-config = { pkgs, ... } : { 8 imports = [./configuration.nix]; 9 inherit config; 10 }; 11 }); 12 img = derivation.outputs.tftpboot; 13 uboot = derivation.outputs.u-boot; 14 pkgsBuild = derivation.pkgs.pkgsBuildBuild; 15 in pkgsBuild.runCommand "check-${deviceName}" { 16 nativeBuildInputs = with pkgsBuild; [ 17 expect 18 socat 19 run-liminix-vm 20 ] ; 21 } '' 22 mkdir vm 23 ln -s ${img} result 24 25 touch empty empty2 26 27 run-liminix-vm \ 28 --background ./vm \ 29 --u-boot ${uboot}/u-boot.bin \ 30 --arch ${derivation.pkgs.stdenv.hostPlatform.qemuArch} \ 31 --wan "user,tftp=`pwd`" \ 32 --disk-image empty2 \ 33 empty empty2 34 35 expect ${./script.expect} 2>&1 |tee $out 36 ''; 37 in { 38 aarch64 = check "qemu-aarch64" {}; 39 arm = check "qemu-armv7l" {}; 40 armZimage = check "qemu-armv7l" { 41 boot.tftp.kernelFormat = "zimage"; 42 }; 43 mips = check "qemu" {}; 44 mipsLz = check "qemu" { 45 boot.tftp.compressRoot = true; 46 }; 47 # this works on real hardware but I haven't figured out how 48 # to make it work on qemu: it says 49 # "OF: fdt: No chosen node found, continuing without" 50 51 # mipsOldUboot = check "qemu" { 52 # boot.tftp.appendDTB = true; 53 # }; 54 }