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