diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,3 +21,4 @@ add_custom_target(check) add_subdirectory(src) +add_subdirectory(test) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,63 @@ +### +# Create config.ini file for tests +### +set(abs_top_srcdir ${CMAKE_SOURCE_DIR}) +set(abs_top_builddir ${CMAKE_BINARY_DIR}) +if(CMAKE_SYSTEM_NAME MATCHES "Windows") + set(EXEEXT ".exe") +endif() + +if(NOT BUILD_BITCOIN_WALLET) + set(ENABLE_WALLET_TRUE "#") +endif() + +if(NOT BUILD_BITCOIN_TX OR NOT BUILD_BITCOIN_TX) + set(BUILD_BITCOIN_UTILS_TRUE "#") +endif() +if(NOT BUILD_BITCOIN_ZMQ) + set(ENABLE_ZMQ_TRUE "#") +endif() + +# Create build ini file +configure_file(config.ini.in config.ini @ONLY) + + +### +# Setup symlinks for testing +### +macro(make_link src dest) + add_custom_command( + OUTPUT "${dest}" + COMMAND ${CMAKE_COMMAND} -E create_symlink "${src}" "${dest}" + COMMENT "make_link ${src} -> ${dest}" + MAIN_DEPENDENCY "${src}" + ) +endmacro() + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/functional/) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/util/) + +make_link( + ${CMAKE_CURRENT_SOURCE_DIR}/functional/test_runner.py + ${CMAKE_CURRENT_BINARY_DIR}/functional/test_runner.py +) +make_link( + ${CMAKE_CURRENT_SOURCE_DIR}/functional/create_cache.py + ${CMAKE_CURRENT_BINARY_DIR}/functional/create_cache.py +) +make_link( + ${CMAKE_CURRENT_SOURCE_DIR}/util/bitcoin-util-test.py + ${CMAKE_CURRENT_BINARY_DIR}/util/bitcoin-util-test.py +) + +add_custom_target(check-functional + COMMAND + ./functional/test_runner.py + DEPENDS + ../src/bitcoind + ${CMAKE_CURRENT_BINARY_DIR}/functional/test_runner.py + ${CMAKE_CURRENT_BINARY_DIR}/functional/create_cache.py + ${CMAKE_CURRENT_BINARY_DIR}/util/bitcoin-util-test.py +) + +add_dependencies(check-all check-functional)