2022-09-25 12:54:31 +02:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
cleanup(){
|
2022-09-26 11:47:29 +02:00
|
|
|
if test -e foo.pid && test -d /proc/`cat foo.pid` ; then
|
|
|
|
echo "killing qemu"
|
|
|
|
kill `cat foo.pid`
|
|
|
|
fi
|
2022-09-25 12:54:31 +02:00
|
|
|
}
|
|
|
|
trap cleanup EXIT
|
2022-09-26 11:47:29 +02:00
|
|
|
fatal(){
|
|
|
|
err=$?
|
|
|
|
echo "FAIL: command $(eval echo $BASH_COMMAND) exited with code $err"
|
|
|
|
exit $err
|
|
|
|
}
|
|
|
|
trap fatal ERR
|
2022-09-25 12:54:31 +02:00
|
|
|
|
2022-10-15 19:55:33 +02:00
|
|
|
NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix-build '<liminix>' -I liminix-config=./configuration.nix --arg device "import <liminix/devices/qemu>" -A outputs.default $*
|
2022-09-25 12:54:31 +02:00
|
|
|
|
2022-09-26 11:47:29 +02:00
|
|
|
if ! ( echo "cont" | socat - unix-connect:../support/ppp-server/qemu-monitor); then
|
2022-09-25 12:54:31 +02:00
|
|
|
echo "need pppoe server running"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-09-26 11:47:29 +02:00
|
|
|
../../scripts/run-qemu.sh --background foo.sock result/vmlinux result/squashfs
|
|
|
|
nix-shell -p expect --run "expect getaddress.expect"
|
2022-09-28 22:33:18 +02:00
|
|
|
|
|
|
|
set -o pipefail
|
|
|
|
response=$(nix-shell -p python3Packages.scapy --run 'python ./test-dhcp-service.py' )
|
|
|
|
|
|
|
|
echo "$response"
|
|
|
|
echo "$response" | nix-shell -p jq --run "jq -e 'select((.router == \"192.168.19.1\") and (.server_id==\"192.168.19.1\"))'"
|