svn commit: r353542 - head/tests/sys/net

Kristof Provost kp at FreeBSD.org
Tue Oct 15 04:50:09 UTC 2019


Author: kp
Date: Tue Oct 15 04:50:08 2019
New Revision: 353542
URL: https://svnweb.freebsd.org/changeset/base/353542

Log:
  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.

Added:
  head/tests/sys/net/if_vlan.sh   (contents, props changed)
Modified:
  head/tests/sys/net/Makefile

Modified: head/tests/sys/net/Makefile
==============================================================================
--- head/tests/sys/net/Makefile	Tue Oct 15 03:51:46 2019	(r353541)
+++ head/tests/sys/net/Makefile	Tue Oct 15 04:50:08 2019	(r353542)
@@ -8,6 +8,7 @@ BINDIR=		${TESTSDIR}
 ATF_TESTS_SH+=	if_lagg_test
 ATF_TESTS_SH+=	if_clone_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

Added: head/tests/sys/net/if_vlan.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tests/sys/net/if_vlan.sh	Tue Oct 15 04:50:08 2019	(r353542)
@@ -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 svn-src-head mailing list