test: add TEST-35-NETWORK-GENERATOR
This commit is contained in:
parent
5cbd45f373
commit
12fc80bed5
1
test/TEST-35-NETWORK-GENERATOR/Makefile
Symbolic link
1
test/TEST-35-NETWORK-GENERATOR/Makefile
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../TEST-01-BASIC/Makefile
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Automatically generated by systemd-network-generator
|
||||||
|
|
||||||
|
[Match]
|
||||||
|
Name=*
|
||||||
|
|
||||||
|
[Link]
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
DHCP=ipv4
|
||||||
|
|
||||||
|
[DHCP]
|
1
test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.input
Normal file
1
test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.input
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ip=dhcp
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Automatically generated by systemd-network-generator
|
||||||
|
|
||||||
|
[NetDev]
|
||||||
|
Kind=bridge
|
||||||
|
Name=bridge99
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Automatically generated by systemd-network-generator
|
||||||
|
|
||||||
|
[Match]
|
||||||
|
Name=bridge99
|
||||||
|
|
||||||
|
[Link]
|
||||||
|
MACAddress=00:11:22:33:44:55
|
||||||
|
MTUBytes=1530
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
DHCP=ipv4
|
||||||
|
|
||||||
|
[DHCP]
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Automatically generated by systemd-network-generator
|
||||||
|
|
||||||
|
[Match]
|
||||||
|
Name=eth0
|
||||||
|
|
||||||
|
[Link]
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
DHCP=no
|
||||||
|
DNS=10.10.10.10
|
||||||
|
DNS=10.10.10.11
|
||||||
|
Bridge=bridge99
|
||||||
|
|
||||||
|
[DHCP]
|
||||||
|
Hostname=hogehoge
|
||||||
|
|
||||||
|
[Address]
|
||||||
|
Address=192.168.0.10/24
|
||||||
|
|
||||||
|
[Route]
|
||||||
|
Gateway=192.168.0.1
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Automatically generated by systemd-network-generator
|
||||||
|
|
||||||
|
[Match]
|
||||||
|
Name=eth1
|
||||||
|
|
||||||
|
[Link]
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
DHCP=no
|
||||||
|
DNS=10.10.10.10
|
||||||
|
DNS=10.10.10.11
|
||||||
|
Bridge=bridge99
|
||||||
|
|
||||||
|
[DHCP]
|
||||||
|
Hostname=hogehoge
|
||||||
|
|
||||||
|
[Address]
|
||||||
|
Address=192.168.0.11/24
|
||||||
|
|
||||||
|
[Route]
|
||||||
|
Gateway=192.168.0.1
|
4
test/TEST-35-NETWORK-GENERATOR/test-02-bridge.input
Normal file
4
test/TEST-35-NETWORK-GENERATOR/test-02-bridge.input
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
ip=192.168.0.10::192.168.0.1:255.255.255.0:hogehoge:eth0:off:10.10.10.10:10.10.10.11
|
||||||
|
ip=192.168.0.11::192.168.0.1:255.255.255.0:hogehoge:eth1:off:10.10.10.10:10.10.10.11
|
||||||
|
ip=bridge99:dhcp:1530:00:11:22:33:44:55
|
||||||
|
bridge=bridge99:eth0,eth1
|
36
test/TEST-35-NETWORK-GENERATOR/test.sh
Executable file
36
test/TEST-35-NETWORK-GENERATOR/test.sh
Executable file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
TEST_DESCRIPTION="network-generator tests"
|
||||||
|
|
||||||
|
. $TEST_BASE_DIR/test-functions
|
||||||
|
|
||||||
|
test_setup() {
|
||||||
|
mkdir -p $TESTDIR/run/systemd/network
|
||||||
|
}
|
||||||
|
|
||||||
|
test_run() {
|
||||||
|
local generator
|
||||||
|
|
||||||
|
if [[ -x $BUILD_DIR/systemd-network-generator ]]; then
|
||||||
|
generator=$BUILD_DIR/systemd-network-generator
|
||||||
|
elif [[ -x /usr/lib/systemd/systemd-network-generator ]]; then
|
||||||
|
generator=/usr/lib/systemd/systemd-network-generator
|
||||||
|
elif [[ -x /lib/systemd/systemd-network-generator ]]; then
|
||||||
|
generator=/lib/systemd/systemd-network-generator
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for f in test-*.input; do
|
||||||
|
echo "*** Running $f"
|
||||||
|
rm -f $TESTDIR/run/systemd/network/*
|
||||||
|
$generator --root $TESTDIR -- $(cat $f)
|
||||||
|
|
||||||
|
if ! diff -u $TESTDIR/run/systemd/network ${f%.input}.expected; then
|
||||||
|
echo "**** Unexpected output for $f"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
do_test "$@"
|
Loading…
Reference in a new issue