run "cd pdns-recursor-*"
run "CFLAGS='-O1' CXXFLAGS='-O1' ./configure \
--prefix=$PDNS_RECURSOR_DIR \
+ --enable-unit-tests \
--disable-silent-rules"
run "make -k -j3"
run "make install"
export PDNSRECURSOR="${PDNS_RECURSOR_DIR}/sbin/pdns_recursor"
export DNSBULKTEST="/usr/bin/dnsbulktest"
export RECCONTROL="${PDNS_RECURSOR_DIR}/bin/rec_control"
+ run "cd pdns/recursordist/pdns-recursor-*"
+ run "make -j 3 check"
+ run "cd ${TRAVIS_BUILD_DIR}"
run "./build-scripts/test-recursor"
export RECURSOR="${PDNSRECURSOR}"
run "cd regression-tests"
packetcache.cc \
qtype.cc \
rcpgenerator.cc \
- recpacketcache.cc recpacketcache.hh \
- rec-protobuf.hh \
responsestats.cc \
responsestats-auth.cc \
sillyrecords.cc \
test-nmtree.cc \
test-packetcache_cc.cc \
test-rcpgenerator_cc.cc \
- test-recpacketcache_cc.cc \
test-sha_hh.cc \
test-statbag_cc.cc \
test-zoneparser_tng_cc.cc \
$(RT_LIBS) \
$(LIBDL)
-if HAVE_PROTOBUF
-if HAVE_PROTOC
-nodist_testrunner_SOURCES = \
- dnsmessage.pb.cc dnsmessage.pb.h
-
-testrunner_LDADD += \
- $(PROTOBUF_LIBS)
-
-recpacketcache.$(OBJEXT): dnsmessage.pb.cc
-endif
-endif
-
if PKCS11
testrunner_SOURCES += pkcs11signers.cc pkcs11signers.hh
testrunner_LDADD += $(P11KIT1_LIBS)
sbin_PROGRAMS = pdns_recursor
bin_PROGRAMS = rec_control
+if UNIT_TESTS
+noinst_PROGRAMS = testrunner
+TESTS_ENVIRONMENT = env BOOST_TEST_LOG_LEVEL=message SRCDIR='$(srcdir)'
+TESTS=testrunner
+else
+check-local:
+ @echo "Unit tests are not enabled"
+ @echo "Run ./configure --enable-unit-tests"
+endif
+
pdns_recursor_SOURCES = \
arguments.cc \
base32.cc base32.hh \
pdns_recursor_LDFLAGS = $(AM_LDFLAGS) \
$(LIBCRYPTO_LDFLAGS) $(BOOST_CONTEXT_LDFLAGS)
+testrunner_SOURCES = \
+ arguments.cc \
+ base32.cc \
+ base64.cc base64.hh \
+ dns.cc dns.hh \
+ dnslabeltext.cc \
+ dnsname.cc dnsname.hh \
+ dnsparser.hh dnsparser.cc \
+ dnsrecords.cc \
+ dnssecinfra.cc \
+ dnswriter.cc dnswriter.hh \
+ ednsoptions.cc ednsoptions.hh \
+ ednssubnet.cc ednssubnet.hh \
+ gettime.cc gettime.hh \
+ gss_context.cc gss_context.hh \
+ iputils.cc iputils.hh \
+ logger.cc logger.hh \
+ misc.cc misc.hh \
+ namespaces.hh \
+ nsecrecords.cc \
+ pdnsexception.hh \
+ protobuf.cc protobuf.hh \
+ qtype.cc qtype.hh \
+ rcpgenerator.cc \
+ recpacketcache.cc recpacketcache.hh \
+ rec-protobuf.cc rec-protobuf.hh \
+ responsestats.cc \
+ sillyrecords.cc \
+ sholder.hh \
+ sstuff.hh \
+ test-arguments_cc.cc \
+ test-base32_cc.cc \
+ test-base64_cc.cc \
+ test-dns_random_hh.cc \
+ test-dnsname_cc.cc \
+ test-dnsparser_hh.cc \
+ test-dnsrecords_cc.cc \
+ test-iputils_hh.cc \
+ test-misc_hh.cc \
+ test-nmtree.cc \
+ test-rcpgenerator_cc.cc \
+ test-recpacketcache_cc.cc \
+ testrunner.cc \
+ unix_utility.cc \
+ zoneparser-tng.cc zoneparser-tng.hh
+
+testrunner_LDFLAGS = \
+ $(AM_LDFLAGS) \
+ $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) \
+ $(LIBCRYPTO_LDFLAGS)
+
+testrunner_LDADD = \
+ $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) \
+ $(LIBCRYPTO_LIBS) \
+ $(RT_LIBS)
+
if BOTAN110
pdns_recursor_SOURCES += \
botan110signers.cc
pdns_recursor_LDADD += $(PROTOBUF_LIBS)
nodist_pdns_recursor_SOURCES = dnsmessage.pb.cc dnsmessage.pb.h
pdns_recursor.$(OBJEXT): dnsmessage.pb.cc
+
+nodist_testrunner_SOURCES = dnsmessage.pb.cc dnsmessage.pb.h
+testrunner_LDADD += $(PROTOBUF_LIBS)
+testrunner$(OBJEXT): dnsmessage.pb.cc
+
endif
endif
BOOST_REQUIRE([$boost_required_version])
PDNS_SELECT_CONTEXT_IMPL
+PDNS_ENABLE_UNIT_TESTS
PDNS_ENABLE_REPRODUCIBLE
PDNS_WITH_LUAJIT
--- /dev/null
+../../../m4/pdns_enable_unit_tests.m4
\ No newline at end of file
+++ /dev/null
-../sha.hh
\ No newline at end of file
--- /dev/null
+../test-arguments_cc.cc
\ No newline at end of file
--- /dev/null
+../test-base32_cc.cc
\ No newline at end of file
--- /dev/null
+../test-base64_cc.cc
\ No newline at end of file
--- /dev/null
+../test-dns_random_hh.cc
\ No newline at end of file
--- /dev/null
+../test-dnsname_cc.cc
\ No newline at end of file
--- /dev/null
+../test-dnsparser_hh.cc
\ No newline at end of file
--- /dev/null
+../test-dnsrecords_cc.cc
\ No newline at end of file
--- /dev/null
+../test-iputils_hh.cc
\ No newline at end of file
--- /dev/null
+../test-misc_hh.cc
\ No newline at end of file
--- /dev/null
+../test-nmtree.cc
\ No newline at end of file
--- /dev/null
+../test-rcpgenerator_cc.cc
\ No newline at end of file
--- /dev/null
+../test-recpacketcache_cc.cc
\ No newline at end of file
--- /dev/null
+/*
+ * This file is part of PowerDNS or dnsdist.
+ * Copyright -- PowerDNS.COM B.V. and its contributors
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * In addition, for the avoidance of any doubt, permission is granted to
+ * link this program with OpenSSL and to (re)distribute the binaries
+ * produced as the result of such linking.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MAIN
+#define BOOST_TEST_MODULE unit
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <boost/test/unit_test.hpp>
+
+