2026-01-02 17:39:53 +00:00
|
|
|
# Test suite for miner project
|
|
|
|
|
|
2026-01-02 18:05:56 +00:00
|
|
|
# Manually specify source files needed for tests with absolute paths
|
|
|
|
|
file(GLOB_RECURSE MINER_SOURCES
|
|
|
|
|
${CMAKE_SOURCE_DIR}/src/3rdparty/fmt/*.cc
|
|
|
|
|
${CMAKE_SOURCE_DIR}/src/base/*.cpp
|
|
|
|
|
${CMAKE_SOURCE_DIR}/src/backend/common/*.cpp
|
|
|
|
|
${CMAKE_SOURCE_DIR}/src/backend/cpu/*.cpp
|
|
|
|
|
${CMAKE_SOURCE_DIR}/src/crypto/cn/*.cpp
|
|
|
|
|
${CMAKE_SOURCE_DIR}/src/crypto/cn/*.c
|
|
|
|
|
${CMAKE_SOURCE_DIR}/src/crypto/common/*.cpp
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Remove test files and platform-specific files not for this architecture
|
|
|
|
|
list(FILTER MINER_SOURCES EXCLUDE REGEX ".*_test\\.cpp$")
|
|
|
|
|
list(FILTER MINER_SOURCES EXCLUDE REGEX ".*_arm.*")
|
|
|
|
|
list(FILTER MINER_SOURCES EXCLUDE REGEX ".*_riscv.*")
|
|
|
|
|
if (WIN32)
|
|
|
|
|
list(FILTER MINER_SOURCES EXCLUDE REGEX ".*_unix\\.cpp$")
|
|
|
|
|
list(FILTER MINER_SOURCES EXCLUDE REGEX ".*_linux\\.cpp$")
|
|
|
|
|
else()
|
|
|
|
|
list(FILTER MINER_SOURCES EXCLUDE REGEX ".*_win\\.cpp$")
|
|
|
|
|
endif()
|
|
|
|
|
|
2026-02-02 02:27:38 +00:00
|
|
|
# Apply necessary compiler flags for specific files (copied from core/CMakeLists.txt)
|
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
|
|
|
|
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/crypto/cn/CnHash.cpp PROPERTIES COMPILE_FLAGS "-Ofast -fno-tree-vectorize")
|
|
|
|
|
|
|
|
|
|
if (WITH_VAES)
|
|
|
|
|
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/crypto/cn/CryptoNight_x86_vaes.cpp PROPERTIES COMPILE_FLAGS "-Ofast -fno-tree-vectorize -mavx2 -mvaes")
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
2026-01-02 17:39:53 +00:00
|
|
|
# Create a library with common test utilities and miner components
|
|
|
|
|
add_library(miner_test_lib STATIC
|
2026-01-02 18:05:56 +00:00
|
|
|
${MINER_SOURCES}
|
2026-01-02 17:39:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
target_include_directories(miner_test_lib PUBLIC
|
|
|
|
|
${CMAKE_SOURCE_DIR}/src
|
|
|
|
|
${CMAKE_SOURCE_DIR}/src/3rdparty
|
|
|
|
|
${UV_INCLUDE_DIR}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
target_link_libraries(miner_test_lib PUBLIC
|
|
|
|
|
${XMRIG_ASM_LIBRARY}
|
|
|
|
|
${OPENSSL_LIBRARIES}
|
|
|
|
|
${UV_LIBRARIES}
|
|
|
|
|
${EXTRA_LIBS}
|
|
|
|
|
${CPUID_LIB}
|
|
|
|
|
${ARGON2_LIBRARY}
|
|
|
|
|
${ETHASH_LIBRARY}
|
|
|
|
|
${GHOSTRIDER_LIBRARY}
|
|
|
|
|
${BLAKE3_LIBRARY}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Unit tests
|
|
|
|
|
add_subdirectory(unit)
|
|
|
|
|
|
|
|
|
|
# Integration tests
|
|
|
|
|
add_subdirectory(integration)
|
|
|
|
|
|
|
|
|
|
# Benchmark tests
|
|
|
|
|
add_subdirectory(benchmark)
|