From f1f1c7bfa38c3b36e145a95b6a515d6ac1d41a6d Mon Sep 17 00:00:00 2001 From: Fancy code <258828110.@qq.com> Date: Wed, 17 Jul 2024 10:09:39 +0800 Subject: [PATCH] Add auto test report. --- test/application/HuntingCamera/CMakeLists.txt | 12 +- test/support_test/gtest2html.xslt | 154 ++++++++++++++++++ 2 files changed, 165 insertions(+), 1 deletion(-) create mode 100755 test/support_test/gtest2html.xslt diff --git a/test/application/HuntingCamera/CMakeLists.txt b/test/application/HuntingCamera/CMakeLists.txt index 007ef1e..28d78aa 100644 --- a/test/application/HuntingCamera/CMakeLists.txt +++ b/test/application/HuntingCamera/CMakeLists.txt @@ -90,4 +90,14 @@ define_file_name(${TARGET_NAME}) # if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tool/CMakeLists.txt") # add_subdirectory(tool) -# endif() \ No newline at end of file +# endif() + +add_custom_target( + HuntingCameraTest_Report + COMMAND ../output_files/test/bin/HuntingCameraTest --gtest_filter=HuntingCameraTest.HS_INTEGRATION_HunttingCamera_EXAMPLE_FormatSDCard --gtest_output=xml:./${TARGET_NAME}.xml + COMMAND xsltproc ${TEST_SOURCE_PATH}/support_test/gtest2html.xslt ${TARGET_NAME}.xml > ${TARGET_NAME}_Report.html + COMMAND lcov --gcov-tool /usr/bin/gcov-9 -c -d . -o ${TARGET_NAME}.info + COMMAND lcov --remove ${TARGET_NAME}.info \"/usr/include/*\" \"${EXTERNAL_SOURCE_PATH}/*\" \"${TEST_SOURCE_PATH}/*\" -o ${TARGET_NAME}_final.info + COMMAND genhtml -o ${TARGET_NAME}_Report ${TARGET_NAME}_final.info + WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/ +) \ No newline at end of file diff --git a/test/support_test/gtest2html.xslt b/test/support_test/gtest2html.xslt new file mode 100755 index 0000000..e4da40a --- /dev/null +++ b/test/support_test/gtest2html.xslt @@ -0,0 +1,154 @@ + + + + + + + Unit Test Results + + + + + + + + + + +

Unit Test Run

+

+ Executed test cases in + test suites, + test cases failed. + Execution time +

+ +
+ + +

+ + + + + + + + + + + + + + + + + + + + + +
Test (/ failed) MessageResult
+ + + + + + FAIL + + =

+
+ + + +
OK
+
+