From c86952ce71387f8330df0600d9f5ea469c6681ff Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Thu, 20 Aug 2020 02:40:27 -0600 Subject: [PATCH] tests: add gre executor tests --- tests/linux/Kyuafile | 1 + tests/linux/gre_test | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 tests/linux/gre_test diff --git a/tests/linux/Kyuafile b/tests/linux/Kyuafile index 99ad1e8..7d7389c 100644 --- a/tests/linux/Kyuafile +++ b/tests/linux/Kyuafile @@ -9,3 +9,4 @@ atf_test_program{name='static_test'} atf_test_program{name='vrf_test'} atf_test_program{name='ppp_test'} atf_test_program{name='tunnel_test'} +atf_test_program{name='gre_test'} diff --git a/tests/linux/gre_test b/tests/linux/gre_test new file mode 100755 index 0000000..1803253 --- /dev/null +++ b/tests/linux/gre_test @@ -0,0 +1,45 @@ +#!/usr/bin/env atf-sh + +. $(atf_get_srcdir)/../test_env.sh +EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/gre" + +tests_init \ + basic_bringup \ + basic_teardown \ + flags_bringup + +basic_bringup_body() { + export MOCK=echo IFACE=tun0 PHASE=pre-up \ + IF_GRE_LOCAL=1.2.3.4 IF_GRE_REMOTE=5.6.7.8 \ + IF_GRE_TTL=255 + atf_check -s exit:0 \ + -o match:"ip -4 link add tun0" \ + -o match:"mode gre" \ + -o match:"ttl '255'" \ + -o match:"local '1.2.3.4'" \ + -o match:"remote '5.6.7.8'" \ + ${EXECUTOR} +} + +basic_teardown_body() { + export MOCK=echo IFACE=tun0 PHASE=post-down \ + IF_GRE_LOCAL=1.2.3.4 IF_GRE_REMOTE=5.6.7.8 \ + IF_GRE_TTL=255 + atf_check -s exit:0 \ + -o match:"ip -4 link del tun0" \ + ${EXECUTOR} +} + +flags_bringup_body() { + export MOCK=echo IFACE=tun0 PHASE=pre-up \ + IF_GRE_LOCAL=1.2.3.4 IF_GRE_REMOTE=5.6.7.8 \ + IF_GRE_TTL=255 IF_GRE_FLAGS="nopmtudisc ignore-df" + atf_check -s exit:0 \ + -o match:"ip -4 link add tun0" \ + -o match:"mode gre" \ + -o match:"ttl '255'" \ + -o match:"local '1.2.3.4'" \ + -o match:"remote '5.6.7.8'" \ + -o match:"nopmtudisc ignore-df" \ + ${EXECUTOR} +}