test script for odhcp6-script

This commit is contained in:
Daniel Barlow 2023-09-08 16:50:47 +01:00
parent 353a199ab2
commit b25103be2e
3 changed files with 71 additions and 0 deletions

View file

@ -0,0 +1,26 @@
./address/2001-8b0-1111-1111-0-ffff-1234-5678/address:2001:8b0:1111:1111:0:ffff:1234:5678
./address/2001-8b0-1111-1111-0-ffff-1234-5678/len:128
./address/2001-8b0-1111-1111-0-ffff-1234-5678/preferred:3600
./address/2001-8b0-1111-1111-0-ffff-1234-5678/valid:7200
./addresses:2001:8b0:1111:1111:0:ffff:1234:5678/128,3600,7200
./ifname:ppp0
./option_1:000300018cfdf02420eb
./option_2:000300010df0feca0df0
./passthru:00170020200108b0000000000000000000002020200108b0000000000000000000002021
./prefix/2001-8b0-de3a-22/address:2001:8b0:de3a:22::
./prefix/2001-8b0-de3a-22/len:64
./prefix/2001-8b0-de3a-22/preferred:7200
./prefix/2001-8b0-de3a-22/valid:7200
./prefix/2001-8b0-de3a-abcd/address:2001:8b0:de3a:abcd::
./prefix/2001-8b0-de3a-abcd/len:64
./prefix/2001-8b0-de3a-abcd/preferred:7200
./prefix/2001-8b0-de3a-abcd/valid:7200
./prefixes:2001:8b0:de3a:abcd::/64,7200,7200 2001:8b0:de3a:22::/64,7200,7200
./ra_hoplimit:64
./ra_mtu:0
./ra_reachable:0
./ra_retransmit:0
./ra_routes:::/0,fe80::203:97ff:fed6:0,65533,512
./rdnss:2001:8b0::2020 2001:8b0::2021
./server:fe80::203:97ff:fed6:0
./state:bound

View file

@ -0,0 +1,29 @@
RA_ADDRESSES=
RA_REACHABLE=0
USER=root
CER=
PASSTHRU=00170020200108b0000000000000000000002020200108b0000000000000000000002021
SHLVL=2
SERVER=fe80::203:97ff:fed6:0
HOME=/home/root/
RA_MTU=0
RA_ROUTES=::/0,fe80::203:97ff:fed6:0,65533,512
OPTION_1=000300018cfdf02420eb
NTP_FQDN=
OPTION_2=000300010df0feca0df0
RA_DOMAINS=
DOMAINS=
LOGNAME=root
AFTR=
SIP_IP=
NTP_IP=
PREFIXES="2001:8b0:de3a:abcd::/64,7200,7200 2001:8b0:de3a:22::/64,7200,7200"
RA_HOPLIMIT=64
SHELL=/bin/sh
RA_DNS=
RDNSS="2001:8b0::2020 2001:8b0::2021"
SNTP_IP=
RA_RETRANSMIT=0
SIP_DOMAIN=
PWD=/home/root
ADDRESSES=2001:8b0:1111:1111:0:ffff:1234:5678/128,3600,7200

16
pkgs/odhcp-script/test.sh Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env sh
set -e
statedir=$(mktemp -d)
cleanup(){
test -n "$statedir" && test -d $statedir && rm -rf $statedir
}
trap 'exit 1' INT HUP QUIT TERM ALRM USR1
trap 'cleanup' EXIT
(set -a; . ./test.env ; SERVICE_STATE=$statedir fennelrepl odhcp6-script.fnl ppp0 bound) 10>&1
(cd $statedir && find . -type f | xargs grep '' | sort) > actual
diff -u expected actual
cmp expected actual