2020-02-10 16:35:27 +00:00
|
|
|
if(NOT WITHOUT_TESTS AND NOT WITHOUT_ADAPTER AND NOT WITHOUT_PROVIDER)
|
|
|
|
|
2020-04-05 15:08:33 +00:00
|
|
|
set(MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --error-exitcode=1")
|
2020-02-10 16:35:27 +00:00
|
|
|
include (CTest)
|
|
|
|
|
2020-04-05 18:11:07 +00:00
|
|
|
add_executable(fs_check
|
|
|
|
test/webfuse/tests/integration/fs_check.c
|
|
|
|
)
|
|
|
|
|
2020-02-10 16:35:27 +00:00
|
|
|
pkg_check_modules(GTEST gtest_main)
|
|
|
|
include(GoogleTest)
|
|
|
|
pkg_check_modules(GMOCK gmock)
|
|
|
|
|
|
|
|
add_executable(alltests
|
2020-03-29 15:40:33 +00:00
|
|
|
test/webfuse/tests/core/jsonrpc/mock_timer_callback.cc
|
|
|
|
test/webfuse/tests/core/jsonrpc/mock_timer.cc
|
|
|
|
test/webfuse/tests/core/jsonrpc/test_is_request.cc
|
|
|
|
test/webfuse/tests/core/jsonrpc/test_request.cc
|
|
|
|
test/webfuse/tests/core/jsonrpc/test_is_response.cc
|
|
|
|
test/webfuse/tests/core/jsonrpc/test_response.cc
|
|
|
|
test/webfuse/tests/core/jsonrpc/test_server.cc
|
|
|
|
test/webfuse/tests/core/jsonrpc/test_proxy.cc
|
|
|
|
test/webfuse/tests/core/jsonrpc/test_response_parser.cc
|
|
|
|
test/webfuse/tests/core/timer/test_timepoint.cc
|
|
|
|
test/webfuse/tests/core/timer/test_timer.cc
|
2020-02-20 16:15:13 +00:00
|
|
|
test/webfuse/utils/tempdir.cc
|
|
|
|
test/webfuse/utils/file_utils.cc
|
|
|
|
test/webfuse/utils/timeout_watcher.cc
|
2020-02-20 17:54:29 +00:00
|
|
|
test/webfuse/utils/path.c
|
|
|
|
test/webfuse/utils/static_filesystem.c
|
2020-02-22 15:46:21 +00:00
|
|
|
test/webfuse/utils/ws_server.cc
|
2020-03-30 18:40:03 +00:00
|
|
|
test/webfuse/mocks/fake_invokation_context.cc
|
2020-02-20 16:15:13 +00:00
|
|
|
test/webfuse/mocks/mock_authenticator.cc
|
|
|
|
test/webfuse/mocks/mock_request.cc
|
2020-02-23 22:20:26 +00:00
|
|
|
test/webfuse/mocks/mock_provider_client.cc
|
2020-03-29 17:30:08 +00:00
|
|
|
test/webfuse/mocks/mock_provider.cc
|
2020-04-03 20:46:47 +00:00
|
|
|
test/webfuse/mocks/mock_fuse.cc
|
2020-04-04 21:27:34 +00:00
|
|
|
test/webfuse/mocks/mock_operation_context.cc
|
2020-04-04 06:32:26 +00:00
|
|
|
test/webfuse/mocks/mock_jsonrpc_proxy.cc
|
2020-03-01 15:55:58 +00:00
|
|
|
test/webfuse//tests/core/test_util.cc
|
2020-02-20 16:15:13 +00:00
|
|
|
test/webfuse/tests/core/test_container_of.cc
|
|
|
|
test/webfuse/tests/core/test_string.cc
|
|
|
|
test/webfuse/tests/core/test_slist.cc
|
|
|
|
test/webfuse/tests/core/test_base64.cc
|
|
|
|
test/webfuse/tests/core/test_status.cc
|
|
|
|
test/webfuse/tests/core/test_message.cc
|
|
|
|
test/webfuse/tests/core/test_message_queue.cc
|
|
|
|
test/webfuse/tests/adapter/test_server.cc
|
|
|
|
test/webfuse/tests/adapter/test_server_config.cc
|
|
|
|
test/webfuse/tests/adapter/test_credentials.cc
|
|
|
|
test/webfuse/tests/adapter/test_authenticator.cc
|
|
|
|
test/webfuse/tests/adapter/test_authenticators.cc
|
|
|
|
test/webfuse/tests/adapter/test_mountpoint.cc
|
|
|
|
test/webfuse/tests/adapter/test_fuse_req.cc
|
2020-04-04 21:16:25 +00:00
|
|
|
test/webfuse/tests/adapter/operation/test_context.cc
|
2020-04-03 20:46:47 +00:00
|
|
|
test/webfuse/tests/adapter/operation/test_open.cc
|
2020-04-04 06:55:59 +00:00
|
|
|
test/webfuse/tests/adapter/operation/test_close.cc
|
2020-04-04 13:41:33 +00:00
|
|
|
test/webfuse/tests/adapter/operation/test_read.cc
|
2020-04-04 18:23:50 +00:00
|
|
|
test/webfuse/tests/adapter/operation/test_readdir.cc
|
2020-04-04 20:26:15 +00:00
|
|
|
test/webfuse/tests/adapter/operation/test_getattr.cc
|
2020-04-04 21:16:25 +00:00
|
|
|
test/webfuse/tests/adapter/operation/test_lookup.cc
|
2020-02-20 16:15:13 +00:00
|
|
|
test/webfuse/tests/provider/test_url.cc
|
|
|
|
test/webfuse/tests/provider/test_client_protocol.cc
|
2020-03-29 17:30:08 +00:00
|
|
|
test/webfuse/tests/provider/operation/test_close.cc
|
2020-03-29 18:41:31 +00:00
|
|
|
test/webfuse/tests/provider/operation/test_getattr.cc
|
2020-03-30 19:16:32 +00:00
|
|
|
test/webfuse/tests/provider/operation/test_lookup.cc
|
2020-03-30 19:42:13 +00:00
|
|
|
test/webfuse/tests/provider/operation/test_open.cc
|
2020-03-30 20:25:14 +00:00
|
|
|
test/webfuse/tests/provider/operation/test_read.cc
|
2020-03-30 20:38:12 +00:00
|
|
|
test/webfuse/tests/provider/operation/test_readdir.cc
|
2020-04-02 20:00:01 +00:00
|
|
|
test/webfuse/tests/integration/test_lowlevel.cc
|
2020-02-20 16:15:13 +00:00
|
|
|
test/webfuse/tests/integration/test_integration.cc
|
2020-04-05 18:11:07 +00:00
|
|
|
test/webfuse/tests/integration/file.cc
|
2020-02-20 16:15:13 +00:00
|
|
|
test/webfuse/tests/integration/server.cc
|
|
|
|
test/webfuse/tests/integration/provider.cc
|
2020-02-10 16:35:27 +00:00
|
|
|
)
|
|
|
|
|
2020-03-22 19:09:40 +00:00
|
|
|
target_link_libraries(alltests PUBLIC
|
|
|
|
-Wl,--wrap=wf_timer_manager_create
|
|
|
|
-Wl,--wrap=wf_timer_manager_dispose
|
|
|
|
-Wl,--wrap=wf_timer_manager_check
|
|
|
|
-Wl,--wrap=wf_timer_create
|
|
|
|
-Wl,--wrap=wf_timer_dispose
|
|
|
|
-Wl,--wrap=wf_timer_start
|
|
|
|
-Wl,--wrap=wf_timer_cancel
|
2020-04-04 21:27:34 +00:00
|
|
|
-Wl,--wrap=wf_impl_operation_context_get_proxy
|
2020-04-04 06:32:26 +00:00
|
|
|
-Wl,--wrap=wf_jsonrpc_proxy_vinvoke
|
2020-04-04 06:55:59 +00:00
|
|
|
-Wl,--wrap=wf_jsonrpc_proxy_vnotify
|
2020-04-03 20:46:47 +00:00
|
|
|
-Wl,--wrap=fuse_req_userdata
|
|
|
|
-Wl,--wrap=fuse_reply_open
|
|
|
|
-Wl,--wrap=fuse_reply_err
|
2020-04-04 13:41:33 +00:00
|
|
|
-Wl,--wrap=fuse_reply_buf
|
2020-04-04 20:26:15 +00:00
|
|
|
-Wl,--wrap=fuse_reply_attr
|
2020-04-04 21:16:25 +00:00
|
|
|
-Wl,--wrap=fuse_reply_entry
|
2020-04-04 20:26:15 +00:00
|
|
|
-Wl,--wrap=fuse_req_ctx
|
2020-03-22 19:09:40 +00:00
|
|
|
|
2020-02-10 16:35:27 +00:00
|
|
|
webfuse-adapter-static
|
|
|
|
webfuse-provider-static
|
|
|
|
webfuse-core
|
|
|
|
${FUSE3_LIBRARIES}
|
|
|
|
${LWS_LIBRARIES}
|
|
|
|
${JANSSON_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
${GMOCK_LIBRARIES}
|
|
|
|
${GTEST_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
2020-03-29 15:40:33 +00:00
|
|
|
target_include_directories(alltests PUBLIC test lib ${FUSE3_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS})
|
|
|
|
target_compile_options(alltests PUBLIC ${FUSE3_CFLAGS_OTHER} ${GMOCK_CFLAGS} ${GTEST_CFLAGS})
|
2020-02-10 16:35:27 +00:00
|
|
|
|
2020-04-01 19:42:50 +00:00
|
|
|
add_custom_command(OUTPUT server-key.pem
|
|
|
|
COMMAND openssl req -x509 -newkey rsa:4096 -keyout server-key.pem -out server-cert.pem -days 365 -nodes -batch -subj '/CN=localhost'
|
|
|
|
COMMAND openssl req -x509 -newkey rsa:4096 -keyout client-key.pem -out client-cert.pem -days 365 -nodes -batch -subj '/CN=localhost'
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_target(gen-tls DEPENDS server-key.pem)
|
|
|
|
add_dependencies(alltests gen-tls)
|
|
|
|
|
2020-02-10 16:35:27 +00:00
|
|
|
enable_testing()
|
|
|
|
gtest_discover_tests(alltests TEST_PREFIX alltests:)
|
|
|
|
|
|
|
|
add_custom_target(coverage
|
2020-03-20 17:18:35 +00:00
|
|
|
mkdir -p coverage
|
|
|
|
COMMAND lcov --initial --capture --directory . --output-file coverage/lcov_base.info --rc lcov_branch_coverage=1
|
|
|
|
COMMAND ./alltests
|
|
|
|
COMMAND lcov --capture --directory . --output-file coverage/lcov.info --rc lcov_branch_coverage=1
|
|
|
|
COMMAND lcov --remove coverage/lcov.info '/usr/*' --output-file coverage/lcov.info --rc lcov_branch_coverage=1
|
|
|
|
COMMAND lcov --remove coverage/lcov.info '*/test/*' --output-file coverage/lcov.info --rc lcov_branch_coverage=1
|
2020-02-10 16:35:27 +00:00
|
|
|
)
|
|
|
|
add_dependencies(coverage alltests)
|
|
|
|
|
|
|
|
add_custom_target(coverage-report
|
2020-03-29 15:40:33 +00:00
|
|
|
COMMAND genhtml --branch-coverage --highlight --legend coverage/lcov.info --output-directory coverage/report
|
2020-02-10 16:35:27 +00:00
|
|
|
)
|
|
|
|
add_dependencies(coverage-report coverage)
|
|
|
|
|
|
|
|
endif(NOT WITHOUT_TESTS AND NOT WITHOUT_ADAPTER AND NOT WITHOUT_PROVIDER)
|