From 0061e24025e467826a3912f634c06fdb62f79e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=85=E6=88=8E=E6=B0=8F?= Date: Sat, 10 Feb 2024 08:48:14 +0800 Subject: [PATCH] fix(test): ctest unable to find executable --- build.bat | 4 +--- test/CMakeLists.txt | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/build.bat b/build.bat index e78daecad2..d85cf694b1 100644 --- a/build.bat +++ b/build.bat @@ -200,10 +200,8 @@ cmake --build %build_dir% --config %build_config% --target install if errorlevel 1 goto error if "%build_test%" == "ON" ( - pushd %build_dir% - ctest --output-on-failure + ctest --test-dir %build_dir% -C %build_config% --output-on-failure if errorlevel 1 goto error - popd ) echo. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 80fb5ddd8f..62c4c1d64b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -13,5 +13,6 @@ endif(BUILD_SHARED_LIBS) file(GLOB test_data_files ${PROJECT_SOURCE_DIR}/data/test/*.yaml) file(COPY ${test_data_files} DESTINATION ${EXECUTABLE_OUTPUT_PATH}) -set(rime_test_executable ${EXECUTABLE_OUTPUT_PATH}/rime_test${ext}) -add_test(rime_test ${rime_test_executable}) +add_test(NAME rime_test + COMMAND rime_test + WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})