liminix

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

test-liminix-rebuild.sh (1723B)


      1 # This is a test for liminix-rebuild. It's not a CI test because
      2 # liminix-rebuild calls nix-build so won't run inside a derivation,
      3 # meaning you have to remember to run it manually when changing
      4 # liminix-rebuild
      5 
      6 # nix-shell -p  expect socat --run "sh ./tests/min-copy-closure/test-liminix-rebuild.sh "
      7 
      8 . tests/test-helpers.sh
      9 
     10 set -e
     11 
     12 here=$(pwd)/tests/min-copy-closure
     13 top=$(pwd)
     14 
     15 work=$(mktemp -d -t "test-lim-rebuild-XXXXXX")
     16 echo $work
     17 cd $work
     18 
     19 deriv(){
     20     (cd $top && nix-build -I liminix-config=${here}/config-ext4.nix  --arg device "import ./devices/qemu-armv7l" -A $1 );
     21 }
     22 
     23 PATH=$(deriv pkgs.pkgsBuildBuild.min-copy-closure)/bin:$(deriv pkgs.pkgsBuildBuild.run-liminix-vm)/bin:$PATH
     24 
     25 rootfs=$(deriv outputs.rootfs)
     26 kernel=$(deriv outputs.zimage)
     27 uboot=$(deriv outputs.u-boot)
     28 
     29 test -d ./vm && rm -rf vm
     30 mkdir ./vm
     31 
     32 cat ${rootfs} > rootfs
     33 
     34 truncate -s 24M rootfs
     35 resize2fs rootfs
     36 
     37 dd if=rootfs of=disk-image bs=512 seek=4 conv=sync
     38 echo '4,-,L,*' | sfdisk disk-image
     39 
     40 run-liminix-vm --background vm  \
     41 	       --command-line "console=ttyAMA0 panic=10 oops=panic loglevel=8 root=/dev/vda1 rootfstype=ext4" \
     42 	       --phram-address 0x50000000 --arch arm \
     43 	       --lan "user,hostfwd=tcp::2022-:22" \
     44 	       --flag -append --flag "root=/dev/vda1" --flag -hda \
     45 	       --flag disk-image $kernel /dev/null
     46 
     47 expect ${here}/wait-until-ready.expect
     48 echo "READY"
     49 
     50 touch known_hosts
     51 export SSH_COMMAND="ssh -o UserKnownHostsFile=${work}/known_hosts -o StrictHostKeyChecking=no -p 2022 -i ${here}/id"
     52 
     53 (cd ${top} && liminix-rebuild root@localhost -I liminix-config=${here}/with-figlet.nix  --arg device "import ./devices/qemu-armv7l")
     54 
     55 ls -l vm
     56 
     57 cd ${work} && expect $here/wait-for-reboot.expect
     58 cd / ; rm -rf $work