From 3036bd1ff4108a19da419ef79c61b1cc9aee54d0 Mon Sep 17 00:00:00 2001 From: keengo99 <3189199@qq.com> Date: Mon, 9 Dec 2024 11:08:18 +0800 Subject: [PATCH] cmake test --- CMakeLists.txt | 2 ++ test/test.sh | 13 ++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8760398..2b14c66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,6 +205,8 @@ endif() add_subdirectory(module/webdav) add_subdirectory(test/test_child) add_dependencies(kangle khttpd) +include(CTest) +add_test(NAME "test_kangle" COMMAND test/test.sh) set(CPACK_SOURCE_IGNORE_FILES "${PROJECT_BINARY_DIR};/.git/;.gitignore;/.vscode;/var;/test/bin;/test/cache;/test/var;/test/tmp;/test/ext;/test/webadmin") install(TARGETS kangle RUNTIME DESTINATION bin diff --git a/test/test.sh b/test/test.sh index 65230cf..2ef944b 100755 --- a/test/test.sh +++ b/test/test.sh @@ -1,10 +1,9 @@ #!/bin/sh -if [ ! -d ext ] ; then - mkdir ext -fi -cp -a ../webadmin . -if [ ! -f ./bin/main.exe ] ; then - echo "please call ./build.sh first" +BIN_FILE=$(readlink -f $0) +PROJECT_PATH=$(dirname $BIN_FILE) +cp -a $PROJECT_PATH/../webadmin $PROJECT_PATH +if [ ! -f $PROJECT_PATH/bin/main.exe ] ; then + echo "please call $PROJECT_PATH/build.sh first" exit 1 fi -./bin/main.exe -e ../build -m=true +$PROJECT_PATH/bin/main.exe -e $PROJECT_PATH/../build -m=true