Index: tests/sys/net/Makefile =================================================================== --- tests/sys/net/Makefile +++ tests/sys/net/Makefile @@ -9,6 +9,7 @@ ATF_TESTS_SH+= if_bridge_test TEST_METADATA.if_bridge_test+= required_programs="python" ATF_TESTS_SH+= if_clone_test +ATF_TESTS_SH+= if_destroy_vnet ATF_TESTS_SH+= if_gif ATF_TESTS_SH+= if_lagg_test ATF_TESTS_SH+= if_stf Index: tests/sys/net/if_destroy_vnet.sh =================================================================== --- /dev/null +++ tests/sys/net/if_destroy_vnet.sh @@ -0,0 +1,35 @@ +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "basic" "cleanup" +basic_head() +{ + # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264981 + atf_set descr 'Basic interface destruction after assigned to a VNET' + atf_set require.user root +} + +basic_body() +{ + vnet_init + + lo_if=$(vnet_mkloopback) + vnet_mkjail jifdestroy ${lo_if} + jexec jifdestroy ifconfig ${lo_if} up + jail -R jifdestroy + # Interface ${lo_if} must be back at the host level after destroying jail + # Pooling for jail shutdown is not sufficient, the vnet interface + # does not appear immediately on the host after jail shutdown. + # So using a racy sleep here. + sleep 1 + atf_check -s exit:0 -o ignore ifconfig ${lo_if} +} + +basic_cleanup() +{ + vnet_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "basic" +}