mirror of
https://github.com/falk-werner/webfuse
synced 2024-10-27 20:34:10 +00:00
sepated unit and integration tests
This commit is contained in:
parent
dcb590bd50
commit
0e0bb74872
@ -49,34 +49,45 @@ if(NOT(WITHOUT_TEST))
|
||||
pkg_check_modules(GTEST REQUIRED gtest_main)
|
||||
pkg_check_modules(GMOCK REQUIRED gmock)
|
||||
|
||||
add_executable(alltests
|
||||
test-src/webfuse/test/tempdir.cpp
|
||||
test-src/webfuse/test/fixture.cpp
|
||||
test-src/webfuse/test/process.cpp
|
||||
test-src/webfuse/test/daemon.cpp
|
||||
test-src/webfuse/test_app.cpp
|
||||
test-src/webfuse/test_request_type.cpp
|
||||
test-src/webfuse/test_response_type.cpp
|
||||
test-src/webfuse/test_access.cpp
|
||||
test-src/webfuse/filesystem/test_status.cpp
|
||||
test-src/webfuse/filesystem/test_accessmode.cpp
|
||||
test-src/webfuse/filesystem/test_openflags.cpp
|
||||
test-src/webfuse/filesystem/test_filemode.cpp
|
||||
add_executable(unit_tests
|
||||
test-src/unit/webfuse/test_app.cpp
|
||||
test-src/unit/webfuse/test_request_type.cpp
|
||||
test-src/unit/webfuse/test_response_type.cpp
|
||||
test-src/unit/webfuse/filesystem/test_status.cpp
|
||||
test-src/unit/webfuse/filesystem/test_accessmode.cpp
|
||||
test-src/unit/webfuse/filesystem/test_openflags.cpp
|
||||
test-src/unit/webfuse/filesystem/test_filemode.cpp
|
||||
)
|
||||
|
||||
target_include_directories(alltests PRIVATE test-src ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS})
|
||||
target_compile_options(alltests PRIVATE
|
||||
target_include_directories(unit_tests PRIVATE test-src/unit ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS})
|
||||
target_compile_options(unit_tests PRIVATE
|
||||
${GTEST_CFLAGS} ${GTEST_CFLAGS_OTHER}
|
||||
${GMOCK_CFLAGS} ${GMOCK_CFLAGS_OTHER}
|
||||
)
|
||||
target_link_libraries(alltests PRIVATE webfuse_static ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES})
|
||||
target_link_libraries(unit_tests PRIVATE webfuse_static ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES})
|
||||
|
||||
add_executable(integration_tests
|
||||
test-src/integration/webfuse/test/tempdir.cpp
|
||||
test-src/integration/webfuse/test/fixture.cpp
|
||||
test-src/integration/webfuse/test/process.cpp
|
||||
test-src/integration/webfuse/test/daemon.cpp
|
||||
test-src/integration/test_access.cpp
|
||||
)
|
||||
|
||||
target_include_directories(integration_tests PRIVATE test-src/integration ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS})
|
||||
target_compile_options(integration_tests PRIVATE
|
||||
${GTEST_CFLAGS} ${GTEST_CFLAGS_OTHER}
|
||||
${GMOCK_CFLAGS} ${GMOCK_CFLAGS_OTHER}
|
||||
)
|
||||
target_link_libraries(integration_tests PRIVATE webfuse_static ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES})
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME alltests COMMAND alltests)
|
||||
add_test(NAME unit_tests COMMAND unit_tests)
|
||||
add_test(NAME integration_tests COMMAND integration_tests)
|
||||
|
||||
find_program(VALGRIND valgrind REQUIRED)
|
||||
if(VALGRIND)
|
||||
add_custom_target(memcheck COMMAND valgrind --leak-check=full --error-exitcode=1 ./alltests --gtest_filter=-*_NO_MEMCHECK)
|
||||
add_custom_target(memcheck COMMAND valgrind --leak-check=full --error-exitcode=1 ./unit_tests)
|
||||
endif()
|
||||
|
||||
endif()
|
@ -35,7 +35,11 @@ extern "C" int webfuse_client_callback(lws * wsi, lws_callback_reasons reason, v
|
||||
break;
|
||||
case LWS_CALLBACK_CLIENT_CONNECTION_ERROR:
|
||||
std::cout << "connection error" << std::endl;
|
||||
// fall-through
|
||||
context->connection = nullptr;
|
||||
context->requests = std::move(std::queue<webfuse::messagewriter>());
|
||||
context->current_message.clear();
|
||||
context->connection_listener(false);
|
||||
break;
|
||||
case LWS_CALLBACK_CLIENT_CLOSED:
|
||||
std::cout << "closed" << std::endl;
|
||||
context->connection = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user