From 660657415977d73451d81981290c9a922875c6e4 Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Tue, 12 Feb 2013 10:19:53 +0100 Subject: test-iptables: Add chain add remove tests --- unit/test-iptables.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/unit/test-iptables.c b/unit/test-iptables.c index 4fb8059f..77fa50a9 100644 --- a/unit/test-iptables.c +++ b/unit/test-iptables.c @@ -84,6 +84,35 @@ static void test_iptables_chain2(void) g_assert(err == 0); } +static void test_iptables_chain3(void) +{ + int err; + + err = __connman_iptables_new_chain("filter", "user-chain-0"); + g_assert(err == 0); + + err = __connman_iptables_commit("filter"); + g_assert(err == 0); + + err = __connman_iptables_new_chain("filter", "user-chain-1"); + g_assert(err == 0); + + err = __connman_iptables_commit("filter"); + g_assert(err == 0); + + err = __connman_iptables_delete_chain("filter", "user-chain-1"); + g_assert(err == 0); + + err = __connman_iptables_commit("filter"); + g_assert(err == 0); + + err = __connman_iptables_delete_chain("filter", "user-chain-0"); + g_assert(err == 0); + + err = __connman_iptables_commit("filter"); + g_assert(err == 0); +} + static void test_iptables_rule0(void) { int err; @@ -265,6 +294,7 @@ int main(int argc, char *argv[]) g_test_add_func("/iptables/chain0", test_iptables_chain0); g_test_add_func("/iptables/chain1", test_iptables_chain1); g_test_add_func("/iptables/chain2", test_iptables_chain2); + g_test_add_func("/iptables/chain3", test_iptables_chain3); g_test_add_func("/iptables/rule0", test_iptables_rule0); g_test_add_func("/iptables/rule1", test_iptables_rule1); g_test_add_func("/iptables/rule2", test_iptables_rule2); -- cgit v1.2.3