W22: coverage metric + network tests + Tool stream feedback + stdin pipe + session path + dependency check (W22.1-W22.6)
Some checks failed
Some checks failed
- W22.1: gcovr 覆盖率度量 + CI coverage job(40% 阈值 warning) - W22.2: network_plugin 单元测试(parse_headers_json/extract_host_port/SSE/异常保护) - W22.3: Tool Calling 流式反馈(chat_stream + "[工具调用]/[工具结果]" 状态行) - W22.4: --prompt stdin pipe(--prompt - 从 stdin 读取) - W22.5: session 路径健壮化(static 缓存 + mkdir + fallback) - W22.6: 插件依赖拓扑静态校验(validate_dependencies 循环/缺失检测) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -177,3 +177,71 @@ target_link_libraries(dstalk-deepseek-plugin-test
|
||||
)
|
||||
|
||||
add_test(NAME dstalk-deepseek-plugin-test COMMAND dstalk-deepseek-plugin-test)
|
||||
|
||||
# ============================================================
|
||||
# dstalk-network-plugin-test — Network 插件单元测试
|
||||
# W22.2 (qa-xu): 通过 #include source 访问 static 函数
|
||||
# ============================================================
|
||||
|
||||
find_package(OpenSSL REQUIRED CONFIG)
|
||||
|
||||
add_executable(dstalk-network-plugin-test
|
||||
network_plugin_test.cpp
|
||||
)
|
||||
|
||||
target_include_directories(dstalk-network-plugin-test
|
||||
PRIVATE ${CMAKE_SOURCE_DIR}/dstalk-core/include
|
||||
)
|
||||
|
||||
target_compile_definitions(dstalk-network-plugin-test
|
||||
PRIVATE
|
||||
BOOST_ALL_NO_LIB
|
||||
)
|
||||
|
||||
target_link_libraries(dstalk-network-plugin-test
|
||||
PRIVATE
|
||||
dstalk
|
||||
boost::boost
|
||||
openssl::openssl
|
||||
)
|
||||
|
||||
add_test(NAME dstalk-network-plugin-test COMMAND dstalk-network-plugin-test)
|
||||
|
||||
# ============================================================
|
||||
# coverage — gcovr 覆盖率报告 (HTML + 终端摘要)
|
||||
# 用法: cmake --build <dir> --target coverage
|
||||
# 前提: 已用 --coverage flag 构建并通过 ctest 运行测试
|
||||
# ============================================================
|
||||
|
||||
find_program(GCOVR_EXECUTABLE gcovr)
|
||||
find_program(GCOV_EXECUTABLE gcov)
|
||||
find_program(LLVM_COV_EXECUTABLE llvm-cov-18 llvm-cov)
|
||||
|
||||
if(GCOVR_EXECUTABLE)
|
||||
if(LLVM_COV_EXECUTABLE)
|
||||
set(GCOV_CMD "${LLVM_COV_EXECUTABLE} gcov")
|
||||
elseif(GCOV_EXECUTABLE)
|
||||
set(GCOV_CMD "${GCOV_EXECUTABLE}")
|
||||
else()
|
||||
set(GCOV_CMD "")
|
||||
endif()
|
||||
|
||||
add_custom_target(coverage
|
||||
COMMAND ${GCOVR_EXECUTABLE} -r ${CMAKE_SOURCE_DIR}
|
||||
--object-directory=${CMAKE_BINARY_DIR}
|
||||
--gcov-executable "${GCOV_CMD}"
|
||||
--print-summary
|
||||
COMMAND ${GCOVR_EXECUTABLE} -r ${CMAKE_SOURCE_DIR}
|
||||
--object-directory=${CMAKE_BINARY_DIR}
|
||||
--gcov-executable "${GCOV_CMD}"
|
||||
--html --html-details
|
||||
-o ${CMAKE_BINARY_DIR}/coverage/index.html
|
||||
COMMENT "Coverage: HTML report -> ${CMAKE_BINARY_DIR}/coverage/index.html"
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
else()
|
||||
add_custom_target(coverage
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "gcovr not found. Install: pip install gcovr"
|
||||
COMMENT "Coverage target unavailable (gcovr not found)"
|
||||
)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user