git: e22a6a4fbfaf - stable/12 - tests: basic VLAN test

Kristof Provost kp at FreeBSD.org
Mon Aug 2 15:04:08 UTC 2021


The branch stable/12 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=e22a6a4fbfaf02c4a76542e1cfad76a8194c0290

commit e22a6a4fbfaf02c4a76542e1cfad76a8194c0290
Author:     Kristof Provost <kp at FreeBSD.org>
AuthorDate: 2019-10-15 04:50:08 +0000
Commit:     Kristof Provost <kp at FreeBSD.org>
CommitDate: 2021-08-02 15:03:02 +0000

    tests: basic VLAN test
    
    Set up two jails connected by an epair. Create VLAN interfaces in both
    jails and check connectivity.
    
    This is a very basic test, but exposed panics during the network stack
    epoch work, so this is worth testing.
    
    (cherry picked from commit fcd69db27dc93796374600938e4fcf5544aa2a06)
---
 tests/sys/net/Makefile   |  1 +
 tests/sys/net/if_vlan.sh | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/tests/sys/net/Makefile b/tests/sys/net/Makefile
index 77c3c833a186..0a6f2a5ea292 100644
--- a/tests/sys/net/Makefile
+++ b/tests/sys/net/Makefile
@@ -10,6 +10,7 @@ ATF_TESTS_SH+=	if_bridge_test
 ATF_TESTS_SH+=	if_clone_test
 ATF_TESTS_SH+=	if_lagg_test
 ATF_TESTS_SH+=	if_tun_test
+ATF_TESTS_SH+=	if_vlan
 
 # The tests are written to be run in parallel, but doing so leads to random
 # panics.  I think it's because the kernel's list of interfaces isn't properly
diff --git a/tests/sys/net/if_vlan.sh b/tests/sys/net/if_vlan.sh
new file mode 100755
index 000000000000..60b799b25675
--- /dev/null
+++ b/tests/sys/net/if_vlan.sh
@@ -0,0 +1,42 @@
+# $FreeBSD$
+
+. $(atf_get_srcdir)/../common/vnet.subr
+
+atf_test_case "basic" "cleanup"
+basic_head()
+{
+	atf_set descr 'Basic VLAN test'
+	atf_set require.user root
+}
+
+basic_body()
+{
+	vnet_init
+
+	epair_vlan=$(vnet_mkepair)
+
+	vnet_mkjail alcatraz ${epair_vlan}a
+	vnet_mkjail singsing ${epair_vlan}b
+
+	vlan0=$(jexec alcatraz ifconfig vlan create vlandev ${epair_vlan}a \
+		vlan 42)
+	jexec alcatraz ifconfig ${epair_vlan}a up
+	jexec alcatraz ifconfig ${vlan0} 10.0.0.1/24 up
+
+	vlan1=$(jexec singsing ifconfig vlan create vlandev ${epair_vlan}b \
+		vlan 42)
+	jexec singsing ifconfig ${epair_vlan}b up
+	jexec singsing ifconfig ${vlan1} 10.0.0.2/24 up
+
+	atf_check -s exit:0 -o ignore jexec singsing ping -c 1 10.0.0.1
+}
+
+basic_cleanup()
+{
+	vnet_cleanup
+}
+
+atf_init_test_cases()
+{
+	atf_add_test_case "basic"
+}


More information about the dev-commits-src-all mailing list