mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
ctest: sspc proxy minimal
CTest does not directly support daemon spawn as part of the test flow, we have to specify it as a "fixture" dependency and then hack up daemonization in a shellscript... this last part unfortunately limits its ability to run to unix type platforms. On those though, if the PROXY_API cmake option is enabled, the ctest flow will spawn the proxy and run lws-minimal-secure-strems-client against it
This commit is contained in:
parent
a1d86d89fa
commit
0ff5a1df75
4 changed files with 52 additions and 2 deletions
|
@ -78,7 +78,7 @@ lws_plat_user_colon_group_to_ids(const char *u_colon_g, uid_t *puid, gid_t *pgid
|
|||
|
||||
p = getpwnam(u);
|
||||
if (!p) {
|
||||
lwsl_err("%s: unknown group '%s'\n", __func__, u);
|
||||
lwsl_err("%s: unknown user '%s'\n", __func__, u);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,11 @@ lws_sspc_sul_retry_cb(lws_sorted_usec_list_t *sul)
|
|||
if (h->context->ss_proxy_bind)
|
||||
i.address = h->context->ss_proxy_bind;
|
||||
else
|
||||
#if defined(__linux__)
|
||||
i.address = "+@proxy.ss.lws";
|
||||
#else
|
||||
i.address = "+/tmp/proxy.ss.lws";
|
||||
#endif
|
||||
}
|
||||
i.host = i.address;
|
||||
i.origin = i.address;
|
||||
|
|
|
@ -585,11 +585,18 @@ lws_ss_proxy_create(struct lws_context *context, const char *bind, int port)
|
|||
info.port = port;
|
||||
if (!port) {
|
||||
if (!bind)
|
||||
#if defined(__linux__)
|
||||
bind = "@proxy.ss.lws";
|
||||
#else
|
||||
bind = "/tmp/proxy.ss.lws";
|
||||
#endif
|
||||
info.options |= LWS_SERVER_OPTION_UNIX_SOCK;
|
||||
}
|
||||
info.iface = bind;
|
||||
#if defined(__linux__)
|
||||
info.unix_socket_perms = "root:root";
|
||||
#else
|
||||
#endif
|
||||
info.listen_accept_role = "raw-skt";
|
||||
info.listen_accept_protocol = "ssproxy-protocol";
|
||||
info.protocols = protocols;
|
||||
|
|
|
@ -17,12 +17,51 @@ require_lws_config(LWS_WITH_SYS_STATE 1 requirements)
|
|||
if (requirements)
|
||||
add_executable(${SAMP} minimal-secure-streams.c)
|
||||
|
||||
if (LWS_CTEST_INTERNET_AVAILABLE)
|
||||
if (LWS_CTEST_INTERNET_AVAILABLE AND NOT WIN32)
|
||||
add_test(NAME ss-warmcat COMMAND lws-minimal-secure-streams)
|
||||
set_tests_properties(ss-warmcat
|
||||
PROPERTIES
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/secure-streams/minimal-secure-streams
|
||||
TIMEOUT 20)
|
||||
|
||||
if (HAS_LWS_WITH_SECURE_STREAMS_PROXY_API OR LWS_WITH_SECURE_STREAMS_PROXY_API)
|
||||
|
||||
#
|
||||
# Define test dep to bring up and take down the test
|
||||
# proxy
|
||||
#
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
# uds abstract namespace for linux
|
||||
set(CTEST_SOCKET_PATH "@ctest-ssp-$ENV{SAI_PROJECT}-$ENV{SAI_OVN}")
|
||||
else()
|
||||
# filesystem socket for others
|
||||
set(CTEST_SOCKET_PATH "/tmp/ctest-ssp-$ENV{SAI_PROJECT}-$ENV{SAI_OVN}")
|
||||
endif()
|
||||
add_test(NAME st_ssproxy COMMAND
|
||||
${CMAKE_SOURCE_DIR}/scripts/ctest-background.sh
|
||||
ssproxy $<TARGET_FILE:lws-minimal-secure-streams-proxy>
|
||||
-i ${CTEST_SOCKET_PATH} --ignore-sigterm)
|
||||
set_tests_properties(st_ssproxy PROPERTIES WORKING_DIRECTORY . FIXTURES_SETUP ssproxy TIMEOUT 800)
|
||||
|
||||
add_test(NAME ki_ssproxy COMMAND
|
||||
${CMAKE_SOURCE_DIR}/scripts/ctest-background-kill.sh
|
||||
ssproxy $<TARGET_FILE:lws-minimal-secure-streams-proxy>
|
||||
-i ${CTEST_SOCKET_PATH})
|
||||
set_tests_properties(ki_ssproxy PROPERTIES FIXTURES_CLEANUP ssproxy)
|
||||
|
||||
#
|
||||
# the client part that will connect to the proxy
|
||||
#
|
||||
|
||||
add_test(NAME sspc-minimal COMMAND lws-minimal-secure-streams-client -i +${CTEST_SOCKET_PATH})
|
||||
set_tests_properties(sspc-minimal PROPERTIES
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/secure-streams/minimal-secure-streams
|
||||
FIXTURES_REQUIRED "ssproxy"
|
||||
TIMEOUT 40)
|
||||
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if (websockets_shared)
|
||||
|
|
Loading…
Add table
Reference in a new issue