mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-06 16:40:47 +00:00
a7ba32e6bc
Without this, vnet jails for the tests don't get torn down.
Fixes: fe701c39e8
("if_tun: Add basic connectivity test with nc tun support")
65 lines
1.2 KiB
Bash
Executable file
65 lines
1.2 KiB
Bash
Executable file
# $FreeBSD$
|
|
|
|
. $(atf_get_srcdir)/../common/vnet.subr
|
|
|
|
atf_test_case "235704" "cleanup"
|
|
235704_head()
|
|
{
|
|
atf_set descr "Test PR #235704"
|
|
atf_set require.user root
|
|
}
|
|
235704_body()
|
|
{
|
|
vnet_init
|
|
vnet_mkjail one
|
|
|
|
tun=$(jexec one ifconfig tun create)
|
|
jexec one ifconfig ${tun} name foo
|
|
atf_check -s exit:0 jexec one ifconfig foo destroy
|
|
}
|
|
235704_cleanup()
|
|
{
|
|
vnet_cleanup
|
|
}
|
|
|
|
atf_test_case "basic" "cleanup"
|
|
basic_head()
|
|
{
|
|
atf_set descr "Test if_tun using nc"
|
|
atf_set require.user root
|
|
}
|
|
basic_body()
|
|
{
|
|
vnet_init
|
|
|
|
epair=$(vnet_mkepair)
|
|
|
|
tun_duke=$(ifconfig tun create)
|
|
tun_bass=$(ifconfig tun create)
|
|
|
|
vnet_mkjail duke ${epair}a ${tun_duke}
|
|
vnet_mkjail bass ${epair}b ${tun_bass}
|
|
|
|
jexec duke ifconfig ${epair}a inet 10.0.0.1/24 up
|
|
jexec bass ifconfig ${epair}b inet 10.0.0.2/24 up
|
|
|
|
jexec duke nc -u -l --tun /dev/${tun_duke} 10.0.0.1 2600 &
|
|
jexec bass nc -u --tun /dev/${tun_bass} 10.0.0.1 2600 &
|
|
|
|
jexec duke ifconfig ${tun_duke} inet 10.100.0.1/24 10.100.0.2 up
|
|
jexec bass ifconfig ${tun_bass} inet 10.100.0.2/24 10.100.0.1 up
|
|
|
|
atf_check -s exit:0 -o ignore \
|
|
jexec bass ping -c 1 10.100.0.1
|
|
}
|
|
basic_cleanup()
|
|
{
|
|
vnet_cleanup
|
|
}
|
|
|
|
atf_init_test_cases()
|
|
{
|
|
atf_add_test_case "235704"
|
|
atf_add_test_case "basic"
|
|
}
|