From fbf6c85baa6c4320b1d8ce0eaaacd447a270bb23 Mon Sep 17 00:00:00 2001 From: csh Date: Sun, 21 Dec 2025 15:52:09 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20test:=20register=20remaining=20t?= =?UTF-8?q?ests=20in=20ctest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lsp-server/test/CMakeLists.txt | 12 ++++++++++++ lsp-server/test/test_lsp_any/CMakeLists.txt | 5 +++++ lsp-server/test/test_module/CMakeLists.txt | 5 +++++ lsp-server/test/test_provider/CMakeLists.txt | 5 +++++ lsp-server/test/test_scheduler/CMakeLists.txt | 5 +++++ lsp-server/test/test_semantic/CMakeLists.txt | 8 ++++++++ 6 files changed, 40 insertions(+) diff --git a/lsp-server/test/CMakeLists.txt b/lsp-server/test/CMakeLists.txt index ade2597..5606d29 100644 --- a/lsp-server/test/CMakeLists.txt +++ b/lsp-server/test/CMakeLists.txt @@ -40,3 +40,15 @@ endif() if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/test_provider/CMakeLists.txt) add_subdirectory(test_provider) endif() + +if(BUILD_TESTS) + find_program(PYTHON3_EXECUTABLE python3) + if(PYTHON3_EXECUTABLE) + add_test(NAME test_lsp_json + COMMAND ${PYTHON3_EXECUTABLE} + ${CMAKE_CURRENT_LIST_DIR}/run_lsp_json_tests.py + --server $) + else() + message(WARNING "python3 not found; skipping test_lsp_json registration") + endif() +endif() diff --git a/lsp-server/test/test_lsp_any/CMakeLists.txt b/lsp-server/test/test_lsp_any/CMakeLists.txt index 25c3211..d2b9eb0 100644 --- a/lsp-server/test/test_lsp_any/CMakeLists.txt +++ b/lsp-server/test/test_lsp_any/CMakeLists.txt @@ -65,3 +65,8 @@ target_compile_options( ${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic $<$:-g -O0> -Wno-import-implementation-partition-unit-in-interface-unit $<$:-O3>) + +if(BUILD_TESTS) + add_test(NAME test_lsp_any + COMMAND $) +endif() diff --git a/lsp-server/test/test_module/CMakeLists.txt b/lsp-server/test/test_module/CMakeLists.txt index a2bed83..4a475b0 100644 --- a/lsp-server/test/test_module/CMakeLists.txt +++ b/lsp-server/test/test_module/CMakeLists.txt @@ -28,3 +28,8 @@ target_compile_options( -Wall -Wextra -Wpedantic $<$:-g -O0> -Wno-import-implementation-partition-unit-in-interface-unit $<$:-O3>) + +if(BUILD_TESTS) + add_test(NAME test_module + COMMAND $) +endif() diff --git a/lsp-server/test/test_provider/CMakeLists.txt b/lsp-server/test/test_provider/CMakeLists.txt index 7edb248..fc59810 100644 --- a/lsp-server/test/test_provider/CMakeLists.txt +++ b/lsp-server/test/test_provider/CMakeLists.txt @@ -210,3 +210,8 @@ target_compile_options( PRIVATE -Wall -Wextra -Wpedantic $<$:-g -O0> -Wno-import-implementation-partition-unit-in-interface-unit $<$:-O3>) + +if(BUILD_TESTS) + add_test(NAME test_provider + COMMAND $) +endif() diff --git a/lsp-server/test/test_scheduler/CMakeLists.txt b/lsp-server/test/test_scheduler/CMakeLists.txt index 7bbd185..38c33ae 100644 --- a/lsp-server/test/test_scheduler/CMakeLists.txt +++ b/lsp-server/test/test_scheduler/CMakeLists.txt @@ -44,3 +44,8 @@ target_compile_options( PRIVATE -Wall -Wextra -Wpedantic $<$:-g -O0> -Wno-import-implementation-partition-unit-in-interface-unit $<$:-O3>) + +if(BUILD_TESTS) + add_test(NAME test_scheduler + COMMAND $) +endif() diff --git a/lsp-server/test/test_semantic/CMakeLists.txt b/lsp-server/test/test_semantic/CMakeLists.txt index ac6cf80..d62de96 100644 --- a/lsp-server/test/test_semantic/CMakeLists.txt +++ b/lsp-server/test/test_semantic/CMakeLists.txt @@ -120,3 +120,11 @@ target_compile_options( -Wall -Wextra -Wpedantic $<$:-g -O0> -Wno-import-implementation-partition-unit-in-interface-unit $<$:-O3>) + +if(BUILD_TESTS) + add_test(NAME test_semantic_script + COMMAND ${CMAKE_COMMAND} -E env + TEST_SEMANTIC_OVERRIDE=$ + BUILD_PRESET=ctest + bash ${CMAKE_CURRENT_SOURCE_DIR}/test.sh) +endif()