liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

test.nix (1260B)


      1 let
      2   img =
      3     (import <liminix> {
      4       device = import <liminix/devices/qemu>;
      5       liminix-config = ./configuration.nix;
      6     }).outputs.vmroot;
      7   pkgs = import <nixpkgs> { overlays = [ (import ../../overlay.nix <nixpkgs>) ]; };
      8 in
      9 pkgs.runCommand "check"
     10   {
     11     nativeBuildInputs = with pkgs; [
     12       expect
     13       socat
     14       e2fsprogs
     15       util-linux # for sfdisk, fallocate
     16       parted
     17     ];
     18   }
     19   ''
     20     mkdir vm
     21     dd if=/dev/zero of=./vm/stick.e2fs bs=1M count=32
     22     mkfs.ext2 -L backup-disk ./vm/stick.e2fs
     23     dd if=/dev/zero of=./vm/stick.img bs=1M count=38
     24     dd if=./vm/stick.e2fs of=./vm/stick.img bs=512 seek=34 conv=notrunc
     25     parted -s ./vm/stick.img -- mklabel gpt mkpart backup-disk ext2 34s -0M
     26     sync
     27     cp  ./vm/stick.img  ./vm/stick.img.orig
     28 
     29     {
     30 
     31 
     32     ${img}/run.sh  --background ./vm --flag -device --flag usb-ehci,id=xhci --flag -drive  --flag if=none,id=usbstick,format=raw,file=$(pwd)/vm/stick.img
     33     expect ${./script.expect} late
     34     kill $(cat ./vm/pid)
     35 
     36     cp  ./vm/stick.img.orig ./vm/stick.img
     37     ${img}/run.sh  --background ./vm --flag -device --flag usb-ehci,id=xhci --flag -drive  --flag if=none,id=usbstick,format=raw,file=$(pwd)/vm/stick.img
     38     expect ${./script.expect} early
     39 
     40     } | tee  $out
     41 
     42   ''