tests: add tests for ipv6-ra executor

This commit is contained in:
Ariadne Conill 2020-07-26 03:54:06 -06:00
parent 5f078537bf
commit d35a3e3b38
3 changed files with 21 additions and 2 deletions

View file

@ -1,11 +1,11 @@
#!/bin/sh #!/bin/sh
start() { start() {
${MOCK} echo 1 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra ${MOCK} /bin/sh -c "echo 1 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra"
} }
stop() { stop() {
${MOCK} echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra ${MOCK} /bin/sh -c "echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra"
} }
[ -z "$VERBOSE" ] || set -x [ -z "$VERBOSE" ] || set -x

View file

@ -3,3 +3,4 @@ syntax(2)
test_suite('ifupdown-ng') test_suite('ifupdown-ng')
atf_test_program{name='link_test'} atf_test_program{name='link_test'}
atf_test_program{name='ipv6-ra_test'}

18
tests/linux/ipv6-ra_test Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/../test_env.sh
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/ipv6-ra"
tests_init up down
up_body() {
export IFACE=lo PHASE=up MOCK=echo MOCK_ESC=\\
atf_check -s exit:0 -o match:'echo 1 > /proc/sys/net/ipv6/conf/lo/accept_ra' \
${EXECUTOR}
}
down_body() {
export IFACE=lo PHASE=down MOCK=echo MOCK_ESC=\\
atf_check -s exit:0 -o match:'echo 0 > /proc/sys/net/ipv6/conf/lo/accept_ra' \
${EXECUTOR}
}