miniupnpd: configure, Makefile: make tests optional

Tests confuse compilation-database-driven code analysis tools
(specifically, some tests stub out certain functions and the stubs
sometimes get preferred over real definitions). So, make them optional.
This commit is contained in:
Ivan Shapovalov 2024-09-03 16:26:32 +02:00 committed by Thomas Bernard
parent 0ab27a2a32
commit eb3cf72900
3 changed files with 21 additions and 9 deletions

View File

@ -75,10 +75,14 @@ NETFILTER_SCRIPTS = $(addprefix $(SRCDIR)/netfilter/, \
#LDLIBS += -lnfnetlink
EXECUTABLES = miniupnpd testupnpdescgen testgetifstats \
testupnppermissions miniupnpdctl testgetifaddr \
testgetroute testasyncsendto testportinuse \
testssdppktgen testminissdp
EXECUTABLES = miniupnpd miniupnpdctl
ifeq ($(TESTS), 1)
EXECUTABLES += testupnpdescgen testgetifstats \
testupnppermissions testgetifaddr \
testgetroute testasyncsendto testportinuse \
testssdppktgen testminissdp
endif
.PHONY: all clean install dox

View File

@ -68,11 +68,14 @@ NFT_SCRIPTS = $(addprefix $(SRCDIR)/netfilter_nft/scripts/, \
#LDLIBS += -lnfnetlink
EXECUTABLES = miniupnpd miniupnpdctl \
testupnpdescgen testgetifstats \
testupnppermissions testgetifaddr \
testgetroute testasyncsendto testportinuse \
testssdppktgen testminissdp
EXECUTABLES = miniupnpd miniupnpdctl
ifeq ($(TESTS), 1)
EXECUTABLES += testupnpdescgen testgetifstats \
testupnppermissions testgetifaddr \
testgetroute testasyncsendto testportinuse \
testssdppktgen testminissdp
endif
.PHONY: all clean install dox

5
miniupnpd/configure vendored
View File

@ -30,8 +30,11 @@ if [ -z "$HTTPS_KEYFILE" ] ; then
HTTPS_KEYFILE=/etc/miniupnpd/private-key.pem
fi
TESTS=1
for argv; do
case "$argv" in
--disable-tests) TESTS=0 ;;
--ipv6) IPV6=1 ;;
--igd2) IGD2=1 ;;
--strict) STRICT=1 ;;
@ -96,6 +99,7 @@ case "$argv" in
echo " --host-os=<name> For cross build. result of uname -s on the host machine"
echo " --host-os-version=x.x For cross build. result of uname -r on the host machine"
echo " --host-machine=<arch> For cross build. result of uname -m on the host machine"
echo " --disable-tests Do not build tests"
exit 1
;;
*)
@ -592,6 +596,7 @@ if [ "$FW" = "iptables" ] || [ "$FW" = "nftables" ] ; then
echo "# generated by $0 on `date`" > ${CONFIG_MK}
echo "SRCDIR = ${BASEDIR}" >> ${CONFIG_MK}
echo "CPPFLAGS += -I." >> ${CONFIG_MK}
echo "TESTS = ${TESTS}" >> ${CONFIG_MK}
if [ "$PKG_CONFIG" ] ; then
if pkg_detect libcap-ng; then