summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-07-13 04:37:19 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-07-14 10:59:54 +0900
commit12fc80bed5c0d7b0014772f4e155666bd0c9ccad (patch)
treef1dc26c89f41645e3060971b2dfeff7ecde6cf67 /test
parent5cbd45f373fc5886ba1eeee4c7b4ad83cb79211f (diff)
downloadsystemd-12fc80bed5c0d7b0014772f4e155666bd0c9ccad.tar.gz
test: add TEST-35-NETWORK-GENERATOR
Diffstat (limited to 'test')
l---------test/TEST-35-NETWORK-GENERATOR/Makefile1
-rw-r--r--test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.expected/99-initrd-default.network11
-rw-r--r--test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.input1
-rw-r--r--test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-bridge99.netdev5
-rw-r--r--test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-bridge99.network13
-rw-r--r--test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-eth0.network21
-rw-r--r--test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-eth1.network21
-rw-r--r--test/TEST-35-NETWORK-GENERATOR/test-02-bridge.input4
-rwxr-xr-xtest/TEST-35-NETWORK-GENERATOR/test.sh36
9 files changed, 113 insertions, 0 deletions
diff --git a/test/TEST-35-NETWORK-GENERATOR/Makefile b/test/TEST-35-NETWORK-GENERATOR/Makefile
new file mode 120000
index 0000000000..e9f93b1104
--- /dev/null
+++ b/test/TEST-35-NETWORK-GENERATOR/Makefile
@@ -0,0 +1 @@
+../TEST-01-BASIC/Makefile \ No newline at end of file
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.expected/99-initrd-default.network b/test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.expected/99-initrd-default.network
new file mode 100644
index 0000000000..e42ce1e311
--- /dev/null
+++ b/test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.expected/99-initrd-default.network
@@ -0,0 +1,11 @@
+# Automatically generated by systemd-network-generator
+
+[Match]
+Name=*
+
+[Link]
+
+[Network]
+DHCP=ipv4
+
+[DHCP]
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.input b/test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.input
new file mode 100644
index 0000000000..e55893e756
--- /dev/null
+++ b/test/TEST-35-NETWORK-GENERATOR/test-01-dhcp.input
@@ -0,0 +1 @@
+ip=dhcp
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-bridge99.netdev b/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-bridge99.netdev
new file mode 100644
index 0000000000..97c22485b7
--- /dev/null
+++ b/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-bridge99.netdev
@@ -0,0 +1,5 @@
+# Automatically generated by systemd-network-generator
+
+[NetDev]
+Kind=bridge
+Name=bridge99
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-bridge99.network b/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-bridge99.network
new file mode 100644
index 0000000000..f8d19baaea
--- /dev/null
+++ b/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-bridge99.network
@@ -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]
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-eth0.network b/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-eth0.network
new file mode 100644
index 0000000000..8842b57921
--- /dev/null
+++ b/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-eth0.network
@@ -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
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-eth1.network b/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-eth1.network
new file mode 100644
index 0000000000..feff4f5ba8
--- /dev/null
+++ b/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.expected/98-initrd-eth1.network
@@ -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
diff --git a/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.input b/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.input
new file mode 100644
index 0000000000..0c863fc356
--- /dev/null
+++ b/test/TEST-35-NETWORK-GENERATOR/test-02-bridge.input
@@ -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
diff --git a/test/TEST-35-NETWORK-GENERATOR/test.sh b/test/TEST-35-NETWORK-GENERATOR/test.sh
new file mode 100755
index 0000000000..4ee5da533f
--- /dev/null
+++ b/test/TEST-35-NETWORK-GENERATOR/test.sh
@@ -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 "$@"