From d35a3e3b38da3e84ac2e72575a3ee4eae041385e Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sun, 26 Jul 2020 03:54:06 -0600 Subject: [PATCH] tests: add tests for ipv6-ra executor --- executor-scripts/linux/ipv6-ra | 4 ++-- tests/linux/Kyuafile | 1 + tests/linux/ipv6-ra_test | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100755 tests/linux/ipv6-ra_test diff --git a/executor-scripts/linux/ipv6-ra b/executor-scripts/linux/ipv6-ra index 0e16ecf..95b5f64 100755 --- a/executor-scripts/linux/ipv6-ra +++ b/executor-scripts/linux/ipv6-ra @@ -1,11 +1,11 @@ #!/bin/sh 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() { - ${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 diff --git a/tests/linux/Kyuafile b/tests/linux/Kyuafile index c98399c..1aa036a 100644 --- a/tests/linux/Kyuafile +++ b/tests/linux/Kyuafile @@ -3,3 +3,4 @@ syntax(2) test_suite('ifupdown-ng') atf_test_program{name='link_test'} +atf_test_program{name='ipv6-ra_test'} diff --git a/tests/linux/ipv6-ra_test b/tests/linux/ipv6-ra_test new file mode 100755 index 0000000..994823d --- /dev/null +++ b/tests/linux/ipv6-ra_test @@ -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} +}