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-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-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;