2017-05-19 22:22:40 +02:00
|
|
|
# Makefile for Nagios tests using libtap
|
|
|
|
|
|
|
|
|
|
|
|
# Source code directories
|
|
|
|
SRC_COMMON=../common
|
|
|
|
SRC_INCLUDE=../include
|
|
|
|
SRC_XDATA=../xdata
|
|
|
|
SRC_BASE=../base
|
|
|
|
SRC_CGI=../cgi
|
|
|
|
SRC_COMMON=../common
|
2017-05-19 23:37:19 +02:00
|
|
|
SRC_LIB=../lib
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
CC=@CC@
|
2017-05-19 23:37:19 +02:00
|
|
|
CFLAGS=@CFLAGS@ @DEFS@ -DNSCORE -I../include -I../tap/src -I..
|
2017-05-19 22:22:40 +02:00
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
TESTS = test_logging
|
|
|
|
TESTS += test_events
|
2017-05-19 22:22:40 +02:00
|
|
|
TESTS += test_checks
|
|
|
|
TESTS += test_commands
|
|
|
|
TESTS += test_downtime
|
2017-05-19 23:37:19 +02:00
|
|
|
TESTS += test_nagios_config
|
|
|
|
TESTS += test_timeperiods
|
|
|
|
TESTS += test_macros
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
XSD_OBJS = $(SRC_CGI)/statusdata-cgi.o $(SRC_CGI)/xstatusdata-cgi.o
|
|
|
|
XSD_OBJS += $(SRC_CGI)/objects-cgi.o $(SRC_CGI)/xobjects-cgi.o
|
|
|
|
XSD_OBJS += $(SRC_CGI)/comments-cgi.o $(SRC_CGI)/downtime-cgi.o
|
2017-05-19 23:37:19 +02:00
|
|
|
XSD_OBJS += $(SRC_CGI)/cgiutils.o ../common/shared.o
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
TP_OBJS = $(SRC_BASE)/utils.o $(SRC_BASE)/config.o $(SRC_BASE)/macros-base.o
|
|
|
|
TP_OBJS += $(SRC_BASE)/objects-base.o $(SRC_BASE)/xobjects-base.o
|
2017-05-19 23:37:19 +02:00
|
|
|
TP_OBJS += ../common/shared.o
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
CFG_OBJS = $(TP_OBJS)
|
|
|
|
CFG_OBJS += $(SRC_BASE)/comments-base.o $(SRC_BASE)/xcomments-base.o
|
|
|
|
CFG_OBJS += $(SRC_BASE)/downtime-base.o $(SRC_BASE)/xdowntime-base.o
|
|
|
|
CFG_OBJS += $(SRC_BASE)/retention-base.o $(SRC_BASE)/xretention-base.o
|
|
|
|
|
|
|
|
|
|
|
|
LDFLAGS=@LDFLAGS@
|
2017-05-19 23:37:19 +02:00
|
|
|
LIBS=@LIBS@ ../lib/libnagios.a
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
prefix=@prefix@
|
|
|
|
exec_prefix=@exec_prefix@
|
|
|
|
LOGDIR=@localstatedir@
|
|
|
|
CFGDIR=@sysconfdir@
|
|
|
|
BINDIR=@bindir@
|
2019-04-18 17:09:18 +02:00
|
|
|
CGIDIR=@cgibindir@
|
|
|
|
HTMLDIR=@webdir@
|
2017-05-19 22:22:40 +02:00
|
|
|
INSTALL=@INSTALL@
|
|
|
|
INSTALL_OPTS=@INSTALL_OPTS@
|
|
|
|
COMMAND_OPTS=@COMMAND_OPTS@
|
|
|
|
STRIP=@STRIP@
|
|
|
|
|
|
|
|
CGIURL=@cgiurl@
|
|
|
|
HTMURL=@htmurl@
|
|
|
|
|
|
|
|
MATHLIBS=-lm
|
|
|
|
PERLLIBS=@PERLLIBS@
|
|
|
|
PERLXSI_O=@PERLXSI_O@
|
|
|
|
SOCKETLIBS=@SOCKETLIBS@
|
|
|
|
BROKERLIBS=@BROKERLIBS@
|
|
|
|
|
|
|
|
BROKER_LDFLAGS=@BROKER_LDFLAGS@
|
|
|
|
|
|
|
|
CP=@CP@
|
|
|
|
|
|
|
|
# Extra base code
|
|
|
|
BASEEXTRALIBS=@BASEEXTRALIBS@
|
|
|
|
|
|
|
|
TAPOBJ=../tap/src/tap.o $(SNPRINTF_O)
|
|
|
|
|
|
|
|
all: $(TESTS)
|
|
|
|
|
|
|
|
########## TESTS ##########
|
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
test_logging: test_logging.o $(SRC_BASE)/logging.o $(TAPOBJ) $(SRC_COMMON)/shared.o $(SRC_BASE)/objects-base.o
|
|
|
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
|
2017-05-19 22:22:40 +02:00
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
test_events: test_events.o $(SRC_BASE)/events.o $(TAPOBJ) $(SRC_BASE)/utils.o $(SRC_COMMON)/shared.o $(SRC_BASE)/objects-base.o $(SRC_BASE)/checks.o $(SRC_LIB)/squeue.o $(SRC_LIB)/nsutils.o $(SRC_LIB)/kvvec.o $(SRC_LIB)/dkhash.o $(SRC_LIB)/pqueue.o $(SRC_BASE)/config.o $(SRC_LIB)/nspath.o $(SRC_BASE)/macros-base.o $(SRC_XDATA)/xodtemplate.o $(SRC_LIB)/bitmap.o $(SRC_LIB)/skiplist.o
|
|
|
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(MATHLIBS)
|
2017-05-19 22:22:40 +02:00
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
test_checks: test_checks.o $(SRC_BASE)/checks.o $(TAPOBJ) $(SRC_BASE)/utils.o $(SRC_COMMON)/shared.o $(SRC_BASE)/objects-base.o
|
2017-05-19 22:22:40 +02:00
|
|
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(MATHLIBS) $(LIBS)
|
|
|
|
|
|
|
|
test_commands: test_commands.o $(SRC_COMMON)/shared.o $(TAPOBJ)
|
2019-04-18 17:09:18 +02:00
|
|
|
$(CC) $(CFLAGS) -o $@ $^ $(SRC_BASE)/commands.o $(LIBS)
|
2017-05-19 22:22:40 +02:00
|
|
|
|
2019-04-18 17:09:18 +02:00
|
|
|
test_downtime: test_downtime.o $(SRC_BASE)/downtime-base.o $(SRC_BASE)/utils.o $(SRC_COMMON)/shared.o $(SRC_BASE)/checks.o $(SRC_BASE)/config.o $(SRC_BASE)/objects-base.o $(SRC_BASE)/macros-base.o $(SRC_XDATA)/xodtemplate.o $(TAPOBJ)
|
2017-05-19 23:37:19 +02:00
|
|
|
$(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(MATHLIBS)
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
test_freshness: test_freshness.o $(SRC_BASE)/freshness.o $(TAPOBJ)
|
|
|
|
$(CC) $(CFLAGS) -o $@ $^
|
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
test_nagios_config: test_nagios_config.o $(TAPOBJ) $(SRC_BASE)/utils.o $(SRC_BASE)/config.o $(SRC_XDATA)/xrddefault.o $(SRC_BASE)/comments-base.o $(SRC_BASE)/downtime-base.o $(SRC_COMMON)/shared.o $(SRC_BASE)/objects-base.o $(SRC_XDATA)/xcddefault.o $(SRC_XDATA)/xodtemplate.o $(SRC_BASE)/macros-base.o
|
|
|
|
$(CC) $(CFLAGS) -o $@ $^ $(BROKER_LDFLAGS) $(LDFLAGS) $(MATHLIBS) $(SOCKETLIBS) $(BROKERLIBS) $(LIBS)
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
test_timeperiods: test_timeperiods.o $(TP_OBJS) $(TAPOBJ)
|
2017-05-19 23:37:19 +02:00
|
|
|
$(CC) $(CFLAGS) -o $@ $^ $(BROKER_LDFLAGS) $(LDFLAGS) $(MATHLIBS) $(SOCKETLIBS) $(BROKERLIBS) $(LIBS)
|
|
|
|
|
|
|
|
test_macros: test_macros.o $(TP_OBJS) $(TAPOBJ)
|
2019-04-18 17:09:18 +02:00
|
|
|
$(CC) $(CFLAGS) -o $@ $^ $(SRC_BASE)/checks.o $(BROKER_LDFLAGS) $(LDFLAGS) $(MATHLIBS) $(SOCKETLIBS) $(LIBS)
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
test_xsddefault: test_xsddefault.o $(XSD_OBJS) $(TAPOBJ)
|
|
|
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
|
|
|
|
|
|
|
test: $(TESTS)
|
2019-04-18 17:09:18 +02:00
|
|
|
HARNESS_PERL=./test_each.t perl -MTest::Harness -e '$$Test::Harness::switches=""; runtests(map { "./$$_" } @ARGV)' $(TESTS) 2>&1
|
|
|
|
if which valgrind >/dev/null 2>&1; then \
|
|
|
|
valgrind ./test_macros; \
|
|
|
|
valgrind ./test_checks; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
each_test: $(TESTS)
|
|
|
|
@for t in $(TESTS); do ./$$t 2>&1; done
|
|
|
|
|
|
|
|
valgrind_test: $(TESTS)
|
|
|
|
@for t in $(TESTS); do valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes ./$$t; done
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
clean:
|
2017-05-19 23:37:19 +02:00
|
|
|
rm -f core core.* *.o gmon.out $(TESTS)
|
2017-05-19 22:22:40 +02:00
|
|
|
rm -f *~ *.*~
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
rm -f perlxsi.c
|
|
|
|
rm -f Makefile
|
|
|
|
|
|
|
|
devclean: distclean
|
|
|
|
|