The branch, master has been updated via 299af4a gitlab-ci: Add csbuild via 8609a8e tests: Protect IPv6 in st_echo_tcp_get_peer_sock_name via 28aeac8 cmake: SWRAP_REQUIRED_LIBRARIES should be a list via dfeb05d cmake: Set LINK_FLAGS for echo_srv via cdf557d cmake: Set LINK_FLAGS for socket_wrapper via 51fcd0a cmake: Only set default flags if they have been detected via d9a6ecb cmake: Disable stack protector on Solaris from efbb27d gitlab-ci: Enable freebsd runner
https://git.samba.org/?p=socket_wrapper.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 299af4a68ac51dd86143d3c4750b2571e98bcc58 Author: Andreas Schneider <a...@samba.org> Date: Wed Nov 7 08:31:50 2018 +0100 gitlab-ci: Add csbuild Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 8609a8eb39a097b47081f34fc9197b9a33d0c2c8 Author: Andreas Schneider <a...@samba.org> Date: Wed Nov 7 09:05:30 2018 +0100 tests: Protect IPv6 in st_echo_tcp_get_peer_sock_name Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 28aeac863cd829783aca1281ecde274266e40f09 Author: Andreas Schneider <a...@samba.org> Date: Wed Nov 7 09:02:35 2018 +0100 cmake: SWRAP_REQUIRED_LIBRARIES should be a list Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit dfeb05d87bac0d81f2676fbc22430bd0018eaa49 Author: Andreas Schneider <a...@samba.org> Date: Wed Nov 7 09:14:40 2018 +0100 cmake: Set LINK_FLAGS for echo_srv Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit cdf557dbca4df47301922c6304269f874236c759 Author: Andreas Schneider <a...@samba.org> Date: Wed Nov 7 09:13:26 2018 +0100 cmake: Set LINK_FLAGS for socket_wrapper Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 51fcd0af8a7017aea779b8516d7520df20bec454 Author: Andreas Schneider <a...@samba.org> Date: Wed Nov 7 09:25:54 2018 +0100 cmake: Only set default flags if they have been detected Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit d9a6ecb148ae6fe485e8b7416cd5b8265e22804f Author: Andreas Schneider <a...@samba.org> Date: Wed Nov 7 09:27:38 2018 +0100 cmake: Disable stack protector on Solaris They don't work. Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> ----------------------------------------------------------------------- Summary of changes: .gitlab-ci.yml | 31 ++++++++++++++++++++++ CompilerChecks.cmake | 44 ++++++++++++++++++-------------- ConfigureChecks.cmake | 1 - src/CMakeLists.txt | 19 +++++++------- tests/CMakeLists.txt | 5 ++++ tests/test_echo_tcp_get_peer_sock_name.c | 15 +++++++++++ 6 files changed, 86 insertions(+), 29 deletions(-) Changeset truncated at 500 lines: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 00b4576..a2bb099 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -77,6 +77,37 @@ fedora/undefined-sanitizer: paths: - obj/ +fedora/csbuild: + image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD + script: + - | + if [[ -z "$CI_COMMIT_BEFORE_SHA" ]]; then + export CI_COMMIT_BEFORE_SHA=$(git rev-parse HEAD^) + fi + + # Check if the commit exists in this branch + # This is not the case for a force push + git branch --contains $CI_COMMIT_BEFORE_SHA 2>/dev/null || export CI_COMMIT_BEFORE_SHA=$(git rev-parse HEAD^) + + export CI_COMMIT_RANGE="$CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA" + + - csbuild + --build-dir=obj-csbuild + --prep-cmd="cmake -DCMAKE_BUILD_TYPE=Debug -DPICKY_DEVELOPER=ON -DUNIT_TESTING=ON @SRCDIR@" + --build-cmd "make clean && make -j$(nproc)" + --git-commit-range $CI_COMMIT_RANGE + --color + --print-current --print-fixed + tags: + - shared + except: + - tags + artifacts: + expire_in: 1 week + when: on_failure + paths: + - obj-csbuild/ + freebsd/x86_64: image: script: diff --git a/CompilerChecks.cmake b/CompilerChecks.cmake index f5a3c7f..4fa1a83 100644 --- a/CompilerChecks.cmake +++ b/CompilerChecks.cmake @@ -65,27 +65,29 @@ if (UNIX) endif() endif() - check_c_compiler_flag_ssp("-fstack-protector-strong" WITH_STACK_PROTECTOR_STRONG) - if (WITH_STACK_PROTECTOR_STRONG) - list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector-strong") - # This is needed as Solaris has a seperate libssp - if (SOLARIS) - list(APPEND SUPPORTED_LINKER_FLAGS "-fstack-protector-strong") - endif() - else (WITH_STACK_PROTECTOR_STRONG) - check_c_compiler_flag_ssp("-fstack-protector" WITH_STACK_PROTECTOR) - if (WITH_STACK_PROTECTOR) - list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector") + if (NOT SOLARIS) + check_c_compiler_flag_ssp("-fstack-protector-strong" WITH_STACK_PROTECTOR_STRONG) + if (WITH_STACK_PROTECTOR_STRONG) + list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector-strong") # This is needed as Solaris has a seperate libssp if (SOLARIS) - list(APPEND SUPPORTED_LINKER_FLAGS "-fstack-protector") + list(APPEND SUPPORTED_LINKER_FLAGS "-fstack-protector-strong") endif() - endif() - endif (WITH_STACK_PROTECTOR_STRONG) + else (WITH_STACK_PROTECTOR_STRONG) + check_c_compiler_flag_ssp("-fstack-protector" WITH_STACK_PROTECTOR) + if (WITH_STACK_PROTECTOR) + list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector") + # This is needed as Solaris has a seperate libssp + if (SOLARIS) + list(APPEND SUPPORTED_LINKER_FLAGS "-fstack-protector") + endif() + endif() + endif (WITH_STACK_PROTECTOR_STRONG) - check_c_compiler_flag_ssp("-fstack-clash-protection" WITH_STACK_CLASH_PROTECTION) - if (WITH_STACK_CLASH_PROTECTION) - list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-clash-protection") + check_c_compiler_flag_ssp("-fstack-clash-protection" WITH_STACK_CLASH_PROTECTION) + if (WITH_STACK_CLASH_PROTECTION) + list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-clash-protection") + endif() endif() if (PICKY_DEVELOPER) @@ -104,5 +106,9 @@ if (MSVC) add_c_compiler_flag("/D _CRT_SECURE_NO_WARNINGS=1" SUPPORTED_COMPILER_FLAGS) endif() -set(DEFAULT_C_COMPILE_FLAGS ${SUPPORTED_COMPILER_FLAGS} CACHE INTERNAL "Default C Compiler Flags" FORCE) -set(DEFAULT_LINK_FLAGS ${SUPPORTED_LINKER_FLAGS} CACHE INTERNAL "Default C Linker Flags" FORCE) +if (SUPPORTED_COMPILER_FLAGS) + set(DEFAULT_C_COMPILE_FLAGS ${SUPPORTED_COMPILER_FLAGS} CACHE INTERNAL "Default C Compiler Flags" FORCE) +endif() +if (SUPPORTED_LINKER_FLAGS) + set(DEFAULT_LINK_FLAGS ${SUPPORTED_LINKER_FLAGS} CACHE INTERNAL "Default C Linker Flags" FORCE) +endif() diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 17fdd3e..94fed22 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -269,5 +269,4 @@ endif (NOT WIN32) check_type_size(pid_t SIZEOF_PID_T) -string(REPLACE ";" " " _REQUIRED_LIBRARIES "${_REQUIRED_LIBRARIES}") set(SWRAP_REQUIRED_LIBRARIES ${_REQUIRED_LIBRARIES} CACHE INTERNAL "socket_wrapper required system libraries") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e8ec16e..952df75 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,6 +10,16 @@ target_compile_options(socket_wrapper -D_GNU_SOURCE) target_link_libraries(socket_wrapper ${SWRAP_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +set_target_properties(socket_wrapper + PROPERTIES + VERSION ${LIBRARY_VERSION} + SOVERSION ${LIBRARY_SOVERSION}) +if (DEFINED DEFAULT_LINK_FLAGS) + set_target_properties(socket_wrapper + PROPERTIES + LINK_FLAGS ${DEFAULT_LINK_FLAGS}) +endif() + install( TARGETS socket_wrapper @@ -18,13 +28,4 @@ install( ARCHIVE DESTINATION ${LIB_INSTALL_DIR} ) -set_target_properties( - socket_wrapper - PROPERTIES - VERSION - ${LIBRARY_VERSION} - SOVERSION - ${LIBRARY_SOVERSION} -) - set(SOCKET_WRAPPER_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}socket_wrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" PARENT_SCOPE) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2f76c6b..829c243 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -16,6 +16,11 @@ target_compile_options(echo_srv ${DEFAULT_C_COMPILE_FLAGS} -D_GNU_SOURCE) target_link_libraries(echo_srv ${SWRAP_REQUIRED_LIBRARIES}) +if (DEFINED DEFAULT_LINK_FLAGS) + set_target_properties(echo_srv + PROPERTIES + LINK_FLAGS ${DEFAULT_LINK_FLAGS}) +endif() add_library(${TORTURE_LIBRARY} STATIC torture.c) target_compile_options(${TORTURE_LIBRARY} diff --git a/tests/test_echo_tcp_get_peer_sock_name.c b/tests/test_echo_tcp_get_peer_sock_name.c index ac369dd..ec15371 100644 --- a/tests/test_echo_tcp_get_peer_sock_name.c +++ b/tests/test_echo_tcp_get_peer_sock_name.c @@ -33,15 +33,26 @@ static int teardown(void **state) static void _assert_sockaddr_equal(struct torture_address *addr, const char *a, const char * const file, const int line) { +#ifdef HAVE_IPV6 char ip[INET6_ADDRSTRLEN] = { 0 }; +#else + char ip[INET_ADDRSTRLEN] = { 0 }; +#endif const char *p; +#ifdef HAVE_IPV6 p = inet_ntop(addr->sa.ss.ss_family, addr->sa.ss.ss_family == AF_INET6 ? (void *)&addr->sa.in6.sin6_addr : (void *)&addr->sa.in.sin_addr, ip, sizeof(ip)); +#else + p = inet_ntop(addr->sa.ss.ss_family, + (void *)&addr->sa.in.sin_addr, + ip, + sizeof(ip)); +#endif _assert_true(cast_ptr_to_largest_integral_type(p), "inet_ntop: Failed to convert IP address", file, line); @@ -64,9 +75,11 @@ static void _assert_sockaddr_port_equal(struct torture_address *addr, case AF_INET: n_port = addr->sa.in.sin_port; break; +#ifdef HAVE_IPV6 case AF_INET6: n_port = addr->sa.in6.sin6_port; break; +#endif default: return; } @@ -90,9 +103,11 @@ static void _assert_sockaddr_port_range_equal(struct torture_address *addr, case AF_INET: n_port = addr->sa.in.sin_port; break; +#ifdef HAVE_IPV6 case AF_INET6: n_port = addr->sa.in6.sin6_port; break; +#endif default: return; } -- Socket Wrapper Repository