diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1302,15 +1302,6 @@ BUILD_TEST="" fi -AC_MSG_CHECKING([whether to build test_bitcoin-seeder]) -if test x$build_bitcoin_seeder$use_tests = xyesyes; then - AC_MSG_RESULT([yes]) - BUILD_SEEDER_TEST="yes" -else - AC_MSG_RESULT([no]) - BUILD_SEEDER_TEST="" -fi - AC_MSG_CHECKING([whether to reduce exports]) if test x$use_reduce_exports = xyes; then AC_MSG_RESULT([yes]) @@ -1327,7 +1318,6 @@ AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows]) AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes]) AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes]) -AM_CONDITIONAL([ENABLE_SEEDER_TESTS],[test x$BUILD_SEEDER_TEST = xyes]) AM_CONDITIONAL([ENABLE_FUZZ],[test x$enable_fuzz = xyes]) AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt = xyes]) AM_CONDITIONAL([ENABLE_QT_TESTS],[test x$BUILD_TEST_QT = xyes]) diff --git a/contrib/teamcity/build-configurations.json b/contrib/teamcity/build-configurations.json --- a/contrib/teamcity/build-configurations.json +++ b/contrib/teamcity/build-configurations.json @@ -11,7 +11,7 @@ "src/libbitcoinconsensus.*": "lib", "src/test/test_bitcoin": "bin/test_bitcoin", "src/qt/test/test_bitcoin-qt": "bin/test_bitcoin-qt", - "src/seeder/test/test_bitcoin-seeder": "bin/test_bitcoin-seeder", + "src/seeder/test/test-seeder": "bin/test-seeder", "src/qt/test/test_bitcoin-qt.log": "log/qt/test_bitcoin-qt.log", "src/seeder/test/*.log": "log/seeder", "test/tmp/*": "functional" @@ -36,7 +36,7 @@ "config.log": "log/config.log", "src/test-suite.log": "log/test-suite.log", "src/test/*.log": "log", - "src/seeder/test/test_bitcoin-seeder.log": "log/test_bitcoin-seeder.log" + "src/seeder/test/test-seeder.log": "log/test-seeder.log" } }, "build-bench": { diff --git a/contrib/teamcity/builds/build-asan.sh b/contrib/teamcity/builds/build-asan.sh --- a/contrib/teamcity/builds/build-asan.sh +++ b/contrib/teamcity/builds/build-asan.sh @@ -24,7 +24,7 @@ # Libs and utils tests ninja \ check-bitcoin-qt \ - check-bitcoin-seeder \ + check-seeder \ check-bitcoin-util \ ninja check-functional diff --git a/contrib/teamcity/builds/build-clang-10.sh b/contrib/teamcity/builds/build-clang-10.sh --- a/contrib/teamcity/builds/build-clang-10.sh +++ b/contrib/teamcity/builds/build-clang-10.sh @@ -19,7 +19,7 @@ ninja \ test_bitcoin \ test_bitcoin-qt \ - test_bitcoin-seeder \ + test-seeder \ secp256k1-tests \ secp256k1-exhaustive_tests diff --git a/contrib/teamcity/builds/build-diff.sh b/contrib/teamcity/builds/build-diff.sh --- a/contrib/teamcity/builds/build-diff.sh +++ b/contrib/teamcity/builds/build-diff.sh @@ -21,7 +21,7 @@ ninja check-leveldb ninja \ check-bitcoin-qt \ - check-bitcoin-seeder \ + check-seeder \ check-bitcoin-util \ check-devtools \ check-rpcauth \ diff --git a/contrib/teamcity/builds/build-linux64.sh b/contrib/teamcity/builds/build-linux64.sh --- a/contrib/teamcity/builds/build-linux64.sh +++ b/contrib/teamcity/builds/build-linux64.sh @@ -21,7 +21,7 @@ ninja \ check-bitcoin-qt \ - check-bitcoin-seeder \ + check-seeder \ check-bitcoin-util \ check-secp256k1 diff --git a/contrib/teamcity/builds/build-master.sh b/contrib/teamcity/builds/build-master.sh --- a/contrib/teamcity/builds/build-master.sh +++ b/contrib/teamcity/builds/build-master.sh @@ -21,7 +21,7 @@ ninja check-leveldb ninja \ check-bitcoin-qt \ - check-bitcoin-seeder \ + check-seeder \ check-bitcoin-util \ check-devtools \ check-rpcauth \ diff --git a/contrib/teamcity/builds/build-osx.sh b/contrib/teamcity/builds/build-osx.sh --- a/contrib/teamcity/builds/build-osx.sh +++ b/contrib/teamcity/builds/build-osx.sh @@ -17,6 +17,6 @@ build_with_cmake # Build all the targets that are not built as part of the default target -ninja test_bitcoin test_bitcoin-qt test_bitcoin-seeder +ninja test_bitcoin test_bitcoin-qt test-seeder ninja osx-dmg diff --git a/contrib/teamcity/builds/build-tsan.sh b/contrib/teamcity/builds/build-tsan.sh --- a/contrib/teamcity/builds/build-tsan.sh +++ b/contrib/teamcity/builds/build-tsan.sh @@ -18,7 +18,7 @@ # Libs and utils tests ninja \ check-bitcoin-qt \ - check-bitcoin-seeder \ + check-seeder \ check-bitcoin-util \ ninja check-functional diff --git a/contrib/teamcity/builds/build-ubsan.sh b/contrib/teamcity/builds/build-ubsan.sh --- a/contrib/teamcity/builds/build-ubsan.sh +++ b/contrib/teamcity/builds/build-ubsan.sh @@ -19,7 +19,7 @@ # Libs and utils tests ninja \ check-bitcoin-qt \ - check-bitcoin-seeder \ + check-seeder \ check-bitcoin-util \ ninja check-functional diff --git a/doc/unit-tests.md b/doc/unit-tests.md --- a/doc/unit-tests.md +++ b/doc/unit-tests.md @@ -27,11 +27,11 @@ #### bitcoin-seeder unit tests -The `bitcoin-seeder` unit tests can be built with `ninja test_bitcoin-seeder` or -built and run in a single command with `ninja check-bitcoin-seeder`. +The `bitcoin-seeder` unit tests can be built with `ninja test-seeder` or +built and run in a single command with `ninja check-seeder`. To run the `bitcoin-seeder` tests manually, launch -`src/seeder/test/test_bitcoin-seeder`. +`src/seeder/test/test-seeder`. To add more `bitcoin-seeder` tests, add `BOOST_AUTO_TEST_CASE` functions to the existing .cpp files in the `src/seeder/test/` directory or add new .cpp files diff --git a/src/Makefile.am b/src/Makefile.am --- a/src/Makefile.am +++ b/src/Makefile.am @@ -802,7 +802,3 @@ if ENABLE_QT_TESTS include Makefile.qttest.include endif - -if ENABLE_SEEDER_TESTS -include Makefile.seedertest.include -endif diff --git a/src/Makefile.seedertest.include b/src/Makefile.seedertest.include deleted file mode 100644 --- a/src/Makefile.seedertest.include +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2019 The Bitcoin developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -bin_PROGRAMS += seeder/test/test_bitcoin-seeder -TESTS += seeder/test/test_bitcoin-seeder - -seeder_test_test_bitcoin_seeder_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_SEEDER_INCLUDES) \ - $(SEEDER_INCLUDES) $(SEEDER_TEST_INCLUDES) $(TESTDEFS) - -SEEDER_TEST_UTIL = \ - seeder/test/dns_util.h \ - seeder/test/translate_support.cpp \ - seeder/test/util.h - -SEEDER_TESTS = \ - seeder/test/p2p_messaging_tests.cpp \ - seeder/test/write_name_tests.cpp \ - seeder/test/parse_name_tests.cpp - -seeder_test_test_bitcoin_seeder_SOURCES = $(SEEDER_TEST_UTIL) $(SEEDER_TESTS) - -seeder_test_test_bitcoin_seeder_LDADD = \ - $(LIBBITCOIN_SEEDER) \ - $(LIBBITCOIN_COMMON) \ - $(LIBBITCOIN_UTIL) \ - $(LIBUNIVALUE) \ - $(LIBBITCOIN_CRYPTO) \ - $(LIBBITCOIN_CONSENSUS) \ - $(CRYPTO_LIBS) \ - $(BOOST_LIBS) \ - $(BOOST_UNIT_TEST_FRAMEWORK_LIB) - -seeder_test_test_bitcoin_seeder_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -seeder_test_test_bitcoin_seeder_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) - -test_bitcoin_seeder : seeder/test/test_bitcoin-seeder$(EXEEXT) - -test_bitcoin_seeder_check : seeder/test/test_bitcoin-seeder$(EXEEXT) FORCE - $(MAKE) check-TESTS TESTS=$^ - -test_bitcoin_seeder_clean: FORCE - rm -f $(seeder_test_test_bitcoin_seeder_OBJECTS) diff --git a/src/seeder/test/CMakeLists.txt b/src/seeder/test/CMakeLists.txt --- a/src/seeder/test/CMakeLists.txt +++ b/src/seeder/test/CMakeLists.txt @@ -5,11 +5,11 @@ project(bitcoin-seeder-test) include(TestSuite) -create_test_suite(bitcoin-seeder) -add_dependencies(check check-bitcoin-seeder) +create_test_suite(seeder) +add_dependencies(check check-seeder) -add_boost_unit_tests_to_suite(bitcoin-seeder test_bitcoin-seeder - translate_support.cpp +add_boost_unit_tests_to_suite(seeder test-seeder + fixture.cpp TESTS p2p_messaging_tests.cpp @@ -17,8 +17,9 @@ write_name_tests.cpp ) -target_link_libraries(test_bitcoin-seeder - common - bitcoinconsensus +target_link_libraries(test-seeder seeder + # The seeder has some bizare linking problems makign util necessary here. + util + testutil ) diff --git a/src/seeder/test/fixture.cpp b/src/seeder/test/fixture.cpp new file mode 100644 --- /dev/null +++ b/src/seeder/test/fixture.cpp @@ -0,0 +1,7 @@ +// Copyright (c) 2020 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#define BOOST_TEST_MODULE Seeder Test Suite + +#include diff --git a/src/seeder/test/p2p_messaging_tests.cpp b/src/seeder/test/p2p_messaging_tests.cpp --- a/src/seeder/test/p2p_messaging_tests.cpp +++ b/src/seeder/test/p2p_messaging_tests.cpp @@ -2,8 +2,6 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#define BOOST_TEST_MODULE Bitcoin Seeder Test Suite - #include #include #include diff --git a/src/seeder/test/translate_support.cpp b/src/seeder/test/translate_support.cpp deleted file mode 100644 --- a/src/seeder/test/translate_support.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2020 The Bitcoin developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -/** - * This file exist for the sole purpose of avoiding link error with the - * translate module. For some obscure reason, the seeder tests do not use the - * regular boost test framework and instead had various fixtures dumped into one - * of its test. - */ -#include - -#include - -const std::function G_TRANSLATION_FUN = nullptr;