1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00

added memcheck target

This commit is contained in:
Falk Werner 2022-11-12 13:32:13 +01:00
parent d63993682e
commit 16d9ce7971
2 changed files with 18 additions and 4 deletions

View File

@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- name: Install APT dependencies
run: sudo apt install libfuse3-dev libwebsockets-dev libgtest-dev libgmock-dev
run: sudo apt install libfuse3-dev libwebsockets-dev libgtest-dev libgmock-dev valgrind
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
@ -28,3 +28,6 @@ jobs:
- name: Unit Test
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target test
- name: Memcheck
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target memcheck

View File

@ -18,15 +18,26 @@ target_link_libraries(webfuse PRIVATE webfuse_static)
if(NOT(WITHOUT_TEST))
pkg_check_modules(GTEST REQUIRED IMPORTED_TARGET gtest_main)
pkg_check_modules(GTEST REQUIRED gtest_main)
pkg_check_modules(GMOCK REQUIRED gmock)
add_executable(alltests
test/webfuse/test_app.cpp
)
target_link_libraries(alltests PRIVATE webfuse_static PkgConfig::GTEST)
target_include_directories(alltests PRIVATE ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS})
target_compile_options(alltests PRIVATE
${GTEST_CFLAGS} ${GTEST_CFLAGS_OTHER}
${GMOCK_CFLAGS} ${GMOCK_CFLAGS_OTHER}
)
target_link_libraries(alltests PRIVATE webfuse_static ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES})
enable_testing()
add_test(NAME alltests COMMAND alltests)
endif()
find_program(VALGRIND valgrind REQUIRED)
if(VALGRIND)
add_custom_target(memcheck COMMAND valgrind --leak-check=full --error-exitcode=1 ./alltests)
endif()
endif()