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 --- Makefile.am | 2 +- configure.in | 2 +- qa/Makefile.am | 7 ++++ qa/test_api.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 qa/Makefile.am create mode 100644 qa/test_api.c diff --git a/Makefile.am b/Makefile.am index 262028c..f31ebb4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/Make_global.am AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 -SUBDIRS = include src utils +SUBDIRS = include src utils qa man_MANS = #nfnetlink_conntrack.3 nfnetlink_conntrack.7 diff --git a/configure.in b/configure.in index 6768235..0aa9c40 100644 --- a/configure.in +++ b/configure.in @@ -78,5 +78,5 @@ LIBNFCONNTRACK_LIBS="$LIBNFNETLINK_LIBS" AC_SUBST(LIBNFCONNTRACK_LIBS) dnl Output the makefile -AC_OUTPUT(Makefile src/Makefile include/Makefile utils/Makefile include/libnetfilter_conntrack/Makefile include/internal/Makefile src/conntrack/Makefile src/expect/Makefile src/deprecated/Makefile src/deprecated/l3extensions/Makefile src/deprecated/extensions/Makefile libnetfilter_conntrack.pc) +AC_OUTPUT(Makefile src/Makefile include/Makefile utils/Makefile qa/Makefile include/libnetfilter_conntrack/Makefile include/internal/Makefile src/conntrack/Makefile src/expect/Makefile src/deprecated/Makefile src/deprecated/l3extensions/Makefile src/deprecated/extensions/Makefile libnetfilter_conntrack.pc) 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