From 0f94ee526d87d0e02a742dc22af959e873ce22e2 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sun, 23 Nov 2008 15:24:13 +0100 Subject: qa: add test file to check for missing indirect function calls This patch adds a rudimentary test file to check for possible unset indirect function calls. This automated test should be run after adding a new attribute. Signed-off-by: Pablo Neira Ayuso --- qa/Makefile.am | 7 ++++ qa/test_api.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 qa/Makefile.am create mode 100644 qa/test_api.c (limited to 'qa') diff --git a/qa/Makefile.am b/qa/Makefile.am new file mode 100644 index 0000000..6a9471b --- /dev/null +++ b/qa/Makefile.am @@ -0,0 +1,7 @@ +include $(top_srcdir)/Make_global.am + +check_PROGRAMS = test_api + +test_api_SOURCES = test_api.c +test_api_LDADD = ../src/libnetfilter_conntrack.la +test_api_LDFLAGS = -dynamic -ldl diff --git a/qa/test_api.c b/qa/test_api.c new file mode 100644 index 0000000..eda9d49 --- /dev/null +++ b/qa/test_api.c @@ -0,0 +1,102 @@ +/* + * Run this after adding a new attribute to the nf_conntrack object + */ + +#include +#include +#include +#include + +#include + +/* + * this file contains a test to check the set/get/copy/cmp APIs. + */ + +static eval_sigterm(int status) +{ + switch(WTERMSIG(status)) { + case SIGSEGV: + printf("received SIGSEV\n"); + break; + case 0: + printf("OK\n", WTERMSIG(status)); + break; + default: + printf("exited with signal: %d\n", WTERMSIG(status)); + break; + } +} + +int main() +{ + int ret, i; + struct nfct_handle *h; + struct nf_conntrack *ct, *tmp; + char data[32]; + int status; + + /* initialize fake data for testing purposes */ + for (i=0; i