From: Ton Voon Date: Thu, 26 Jun 2008 22:00:08 +0000 (+0000) Subject: Adding libtap into distribution to help run C based tests X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6c476db6dcc7aa70a687d09c10e6ad515c290c23;p=nagiosplug.git Adding libtap into distribution to help run C based tests git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2013 f882894a-f735-0410-b71e-b25c423dba1c --- diff --git a/Makefile.am b/Makefile.am index 416ef62..98b0dcc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,7 +8,7 @@ EXTRA_DIST = config.rpath \ NPTest.pm contrib pkg nagios-plugins.spec \ config_test/Makefile config_test/run_tests config_test/child_test.c \ perlmods tools/build_perl_modules \ - tools/tinderbox_build + tools/tinderbox_build @TAP_DIR@ ACLOCAL_AMFLAGS = -I gl/m4 -I m4 @@ -22,7 +22,10 @@ dist-hook: install-root: cd plugins-root && $(MAKE) $@ -test test-debug: +tap: + cd @TAP_DIR@ && $(MAKE) + +test test-debug: tap cd lib && $(MAKE) $@ if test "$(PERLMODS_DIR)" != ""; then cd perlmods && $(MAKE) $@; fi cd plugins && $(MAKE) $@ diff --git a/configure.in b/configure.in index 612d686..afde837 100644 --- a/configure.in +++ b/configure.in @@ -154,12 +154,6 @@ AC_CHECK_HEADERS(math.h) AC_CHECK_LIB(m,floor,MATHLIBS="-lm") AC_SUBST(MATHLIBS) -dnl Check for libtap, to run perl-like tests -AC_CHECK_LIB(tap, plan_tests, - EXTRA_TEST="test_utils test_disk test_tcp test_cmd test_base64" - AC_SUBST(EXTRA_TEST) - ) - dnl INI Parsing AC_ARG_ENABLE(extra-opts, AC_HELP_STRING([--enable-extra-opts], @@ -1595,6 +1589,21 @@ if test "$ac_cv_uname_s" = 'SunOS' -a \( "x$ac_cv_prog_ac_ct_AR" = "x" -o "$ac_c AC_MSG_ERROR(No ar found for Solaris - is /usr/ccs/bin in PATH?) fi +AC_ARG_ENABLE(libtap, + AC_HELP_STRING([--enable-libtap], + [Enables configuring of libtap in external/tap/. Run "make tap" to compile (default: no)]), + [enable_libtap=$enableval], + [enable_libtap=no]) +dnl Have to define TAP_DIR so that Makefile can pull it as an extra dist +TAP_DIR=external/tap-1.01 +AC_SUBST(TAP_DIR) +if test "$enable_libtap" = yes; then + dnl Have to have AC_CONFIG_SUBDIRS as a literal + AC_CONFIG_SUBDIRS([external/tap-1.01]) + EXTRA_TEST="test_utils test_disk test_tcp test_cmd test_base64" + AC_SUBST(EXTRA_TEST) +fi + AC_OUTPUT( Makefile lib/Makefile diff --git a/external/README b/external/README new file mode 100644 index 0000000..62a868b --- /dev/null +++ b/external/README @@ -0,0 +1,4 @@ +Changes to tap-1.01.tar.gz from http://jc.ngo.org.uk/trac-bin/trac.cgi/wiki/LibTap: + +Added vasprintf from gnulib (see http://jc.ngo.org.uk/trac-bin/trac.cgi/ticket/32) +Added -UHAVE_LIBPTHREAD (see http://nagiosplugins.org/faq/libtap) diff --git a/external/tap-1.01-altinity.tar.gz b/external/tap-1.01-altinity.tar.gz new file mode 100644 index 0000000..1130ab3 Binary files /dev/null and b/external/tap-1.01-altinity.tar.gz differ diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am index 25e2bed..45c1152 100644 --- a/lib/tests/Makefile.am +++ b/lib/tests/Makefile.am @@ -15,39 +15,41 @@ EXTRA_DIST = $(np_test_scripts) $(np_test_files) LIBS = @LIBINTL@ +TAP_LIB_DIR = $(top_srcdir)/@TAP_DIR@/src + test_utils_SOURCES = test_utils.c test_utils_CFLAGS = -g -I.. -test_utils_LDFLAGS = -L/usr/local/lib -ltap +test_utils_LDFLAGS = -L$(TAP_LIB_DIR) -ltap test_utils_LDADD = ../utils_base.o test_disk_SOURCES = test_disk.c test_disk_CFLAGS = -g -I.. -test_disk_LDFLAGS = -L/usr/local/lib -ltap +test_disk_LDFLAGS = -L$(TAP_LIB_DIR) -ltap test_disk_LDADD = ../utils_disk.o $(top_srcdir)/gl/libgnu.a test_tcp_SOURCES = test_tcp.c test_tcp_CFLAGS = -g -I.. -test_tcp_LDFLAGS = -L/usr/local/lib -ltap +test_tcp_LDFLAGS = -L$(TAP_LIB_DIR) -ltap test_tcp_LDADD = ../utils_tcp.o test_cmd_SOURCES = test_cmd.c test_cmd_CFLAGS = -g -I.. -test_cmd_LDFLAGS = -L/usr/local/lib -ltap +test_cmd_LDFLAGS = -L$(TAP_LIB_DIR) -ltap test_cmd_LDADD = ../utils_cmd.o ../utils_base.o test_base64_SOURCES = test_base64.c test_base64_CFLAGS = -g -I.. -test_base64_LDFLAGS = -L/usr/local/lib -ltap +test_base64_LDFLAGS = -L$(TAP_LIB_DIR) -ltap test_base64_LDADD = $(top_srcdir)/gl/base64.o test_ini_SOURCES = test_ini.c test_ini_CFLAGS = -g -I.. -test_ini_LDFLAGS = -L/usr/local/lib -ltap +test_ini_LDFLAGS = -L$(TAP_LIB_DIR) -ltap test_ini_LDADD = ../utils_base.o ../parse_ini.o test_opts_SOURCES = test_opts.c test_opts_CFLAGS = -g -I.. -test_opts_LDFLAGS = -L/usr/local/lib -ltap +test_opts_LDFLAGS = -L$(TAP_LIB_DIR) -ltap test_opts_LDADD = ../utils_base.o ../parse_ini.o ../extra_opts.o test: ${noinst_PROGRAMS} diff --git a/tools/setup b/tools/setup index 7fdb980..a8d9825 100755 --- a/tools/setup +++ b/tools/setup @@ -49,3 +49,6 @@ fi if [ $docbook = 1 ] ; then cd doc && make fi + +# Untar libtap +cd external && tar --gzip -xf tap-1.01-altinity.tar.gz diff --git a/tools/tinderbox_build b/tools/tinderbox_build index 70fb07a..e8a3e2e 100755 --- a/tools/tinderbox_build +++ b/tools/tinderbox_build @@ -242,8 +242,8 @@ sub SetupPath { sub configure { # Configure - print LOG "./configure $ConfigureArgs\n"; - open (CONFIGURE, "./configure $ConfigureArgs 2>&1 |") || die "../configure: $!\n"; + print LOG "./configure --enable-libtap $ConfigureArgs\n"; + open (CONFIGURE, "./configure --enable-libtap $ConfigureArgs 2>&1 |") || die "../configure: $!\n"; while () { print $_; print LOG $_;