From d19fd99063f40b0f0537d075024dc2a934c8c038 Mon Sep 17 00:00:00 2001 From: Tim Paine Date: Wed, 13 Mar 2024 10:52:21 -0400 Subject: [PATCH 1/3] Enable c++ tests Signed-off-by: Tim Paine --- Makefile | 5 ++++- cpp/tests/core/CMakeLists.txt | 4 ++-- cpp/tests/engine/CMakeLists.txt | 4 ++-- setup.py | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 5aa2b11d3..b1ce473dd 100644 --- a/Makefile +++ b/Makefile @@ -79,12 +79,15 @@ checks: check ######### # TESTS # ######### -.PHONY: test-py coverage-py test tests +.PHONY: test-py test-cpp coverage-py test tests TEST_ARGS := test-py: ## Clean and Make unit tests python -m pytest -v csp/tests --junitxml=junit.xml $(TEST_ARGS) +test-cpp: ## Make C++ unit tests + for f in ./csp/tests/bin/*; do $$f; done || (echo "TEST FAILED" && exit 1) + coverage-py: python -m pytest -v csp/tests --junitxml=junit.xml --cov=csp --cov-report xml --cov-report html --cov-branch --cov-fail-under=80 --cov-report term-missing $(TEST_ARGS) diff --git a/cpp/tests/core/CMakeLists.txt b/cpp/tests/core/CMakeLists.txt index bbc8231e2..61fc93556 100644 --- a/cpp/tests/core/CMakeLists.txt +++ b/cpp/tests/core/CMakeLists.txt @@ -1,10 +1,10 @@ -find_library(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) add_executable(test_basic_allocator test_basic_allocator.cpp) target_link_libraries(test_basic_allocator GTest::gtest GTest::gtest_main) add_executable(test_dynamicbitset test_dynamicbitset.cpp) -target_link_libraries(test_dynamicbitset gtest gtest_main) +target_link_libraries(test_dynamicbitset GTest::gtest GTest::gtest_main) add_executable(test_enum test_enum.cpp) target_link_libraries(test_enum csp_core csp_engine GTest::gtest GTest::gtest_main) diff --git a/cpp/tests/engine/CMakeLists.txt b/cpp/tests/engine/CMakeLists.txt index d8f4c1287..1bf0cf2ed 100644 --- a/cpp/tests/engine/CMakeLists.txt +++ b/cpp/tests/engine/CMakeLists.txt @@ -1,4 +1,4 @@ -find_library(GTest REQUIRED) +find_package(GTest CONFIG REQUIRED) add_executable(test_dictionary test_dictionary.cpp ) target_link_libraries(test_dictionary csp_engine GTest::gtest GTest::gtest_main rt) @@ -7,7 +7,7 @@ add_executable(test_tick_buffer test_tick_buffer.cpp) target_link_libraries(test_tick_buffer csp_engine GTest::gtest GTest::gtest_main) add_executable(test_time_series test_time_series.cpp) -target_link_libraries(test_time_series csp_engine_static gtest gtest_main pthread) +target_link_libraries(test_time_series csp_engine GTest::gtest GTest::gtest_main pthread) add_executable(test_partial_switch_csp_type test_partial_switch_csp_type.cpp) target_link_libraries(test_partial_switch_csp_type csp_engine GTest::gtest GTest::gtest_main) diff --git a/setup.py b/setup.py index ea14be2a6..1a77a139f 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ CSP_USE_VCPKG = os.environ.get("CSP_USE_VCPKG", "1").lower() in ("1", "on") CMAKE_OPTIONS = ( ("CSP_BUILD_NO_CXX_ABI", "0"), - ("CSP_BUILD_TESTS", "0"), + ("CSP_BUILD_TESTS", "1"), ("CSP_MANYLINUX", "0"), ("CSP_BUILD_KAFKA_ADAPTER", "1"), ("CSP_BUILD_PARQUET_ADAPTER", "1"), From d9fbfb1ca785773aa1c8f42b2abf7a2fed50b537 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Thu, 21 Mar 2024 15:18:14 -0400 Subject: [PATCH 2/3] Redo some changes after bad merge Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com> --- Makefile | 2 +- conda/dev-environment-linux.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b1ce473dd..569879578 100644 --- a/Makefile +++ b/Makefile @@ -91,7 +91,7 @@ test-cpp: ## Make C++ unit tests coverage-py: python -m pytest -v csp/tests --junitxml=junit.xml --cov=csp --cov-report xml --cov-report html --cov-branch --cov-fail-under=80 --cov-report term-missing $(TEST_ARGS) -test: test-py ## run the tests +test: test-cpp test-py ## run the tests # Alias tests: test diff --git a/conda/dev-environment-linux.yml b/conda/dev-environment-linux.yml index 3dfc8d096..3f0071971 100644 --- a/conda/dev-environment-linux.yml +++ b/conda/dev-environment-linux.yml @@ -13,6 +13,7 @@ dependencies: - exprtk - flex - python-graphviz + - gtest - httpx - isort - libarrow=15 From f3065f44f3f2aa083bcef352f6b6dcf508469091 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Thu, 21 Mar 2024 15:40:46 -0400 Subject: [PATCH 3/3] Remove rt linkage, also dropped during bad merge Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com> --- cpp/tests/core/CMakeLists.txt | 2 +- cpp/tests/engine/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/tests/core/CMakeLists.txt b/cpp/tests/core/CMakeLists.txt index 61fc93556..4ec496706 100644 --- a/cpp/tests/core/CMakeLists.txt +++ b/cpp/tests/core/CMakeLists.txt @@ -16,7 +16,7 @@ add_executable(test_tagged_pointer_union test_tagged_pointer_union.cpp ) target_link_libraries(test_tagged_pointer_union csp_core GTest::gtest GTest::gtest_main) add_executable(test_time test_time.cpp ) -target_link_libraries(test_time csp_core GTest::gtest GTest::gtest_main rt) +target_link_libraries(test_time csp_core GTest::gtest GTest::gtest_main) install(TARGETS test_basic_allocator diff --git a/cpp/tests/engine/CMakeLists.txt b/cpp/tests/engine/CMakeLists.txt index 1bf0cf2ed..45fb3b783 100644 --- a/cpp/tests/engine/CMakeLists.txt +++ b/cpp/tests/engine/CMakeLists.txt @@ -1,7 +1,7 @@ find_package(GTest CONFIG REQUIRED) add_executable(test_dictionary test_dictionary.cpp ) -target_link_libraries(test_dictionary csp_engine GTest::gtest GTest::gtest_main rt) +target_link_libraries(test_dictionary csp_engine GTest::gtest GTest::gtest_main) add_executable(test_tick_buffer test_tick_buffer.cpp) target_link_libraries(test_tick_buffer csp_engine GTest::gtest GTest::gtest_main)