forked from DGNum/liminix
add wlan test to ci
This commit is contained in:
parent
befc75b060
commit
320d436c65
4 changed files with 41 additions and 26 deletions
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
smoke = import ./smoke/test.nix;
|
smoke = import ./smoke/test.nix;
|
||||||
pseudofiles = import ./pseudofiles/test.nix;
|
pseudofiles = import ./pseudofiles/test.nix;
|
||||||
|
wlan = import ./wlan/test.nix;
|
||||||
pppoe = import ./pppoe/test.nix;
|
pppoe = import ./pppoe/test.nix;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
cleanup(){
|
|
||||||
if test -e foo.pid && test -d /proc/`cat foo.pid` ; then
|
|
||||||
echo "killing qemu"
|
|
||||||
kill `cat foo.pid`
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
trap cleanup EXIT
|
|
||||||
fatal(){
|
|
||||||
err=$?
|
|
||||||
echo "FAIL: command $(eval echo $BASH_COMMAND) exited with code $err"
|
|
||||||
exit $err
|
|
||||||
}
|
|
||||||
trap fatal ERR
|
|
||||||
|
|
||||||
NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix-build '<liminix>' -I liminix-config=./configuration.nix --arg device "import <liminix/devices/qemu>" -A outputs.default $*
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
../../scripts/run-qemu.sh \
|
|
||||||
--background foo.sock \
|
|
||||||
result/vmlinux result/squashfs \
|
|
||||||
|
|
||||||
nix-shell -p expect --run "expect wait-for-wlan.expect"
|
|
39
tests/wlan/test.nix
Normal file
39
tests/wlan/test.nix
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
liminix
|
||||||
|
, nixpkgs
|
||||||
|
}:
|
||||||
|
let img = (import liminix {
|
||||||
|
device = import "${liminix}/devices/qemu/";
|
||||||
|
liminix-config = ./configuration.nix;
|
||||||
|
}).outputs.default;
|
||||||
|
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||||
|
inherit (pkgs.pkgsBuildBuild) mips-vm;
|
||||||
|
in pkgs.runCommand "check" {
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
expect
|
||||||
|
mips-vm
|
||||||
|
socat
|
||||||
|
] ;
|
||||||
|
} ''
|
||||||
|
killpid(){
|
||||||
|
if test -e $1 && test -d /proc/`cat $1` ; then
|
||||||
|
pid=$(cat $1)
|
||||||
|
kill $pid
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup(){
|
||||||
|
killpid ./vm/pid
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
fatal(){
|
||||||
|
err=$?
|
||||||
|
echo "FAIL: command $(eval echo $BASH_COMMAND) exited with code $err"
|
||||||
|
exit $err
|
||||||
|
}
|
||||||
|
trap fatal ERR
|
||||||
|
|
||||||
|
mkdir vm
|
||||||
|
mips-vm --background ./vm ${img}/vmlinux ${img}/squashfs
|
||||||
|
expect ${./wait-for-wlan.expect} > output && mv output $out
|
||||||
|
''
|
|
@ -1,6 +1,6 @@
|
||||||
set timeout 60
|
set timeout 60
|
||||||
|
|
||||||
spawn socat unix-connect:foo.sock -
|
spawn socat unix-connect:vm/console -
|
||||||
send "\r\n"
|
send "\r\n"
|
||||||
expect "login:" { send "root\r\n" }
|
expect "login:" { send "root\r\n" }
|
||||||
expect "/ #"
|
expect "/ #"
|
||||||
|
|
Loading…
Reference in a new issue