more 32 bit tests, doc fix

This commit is contained in:
tezc 2021-04-27 21:13:23 +03:00
parent 62001ca6fc
commit 796bd45663
6 changed files with 45 additions and 17 deletions

View File

@ -63,4 +63,32 @@ jobs:
mkdir build-debug && cd build-debug
cmake .. -DSC_CLANG_TIDY=1
make -j
make check
ubuntu-32bit-address:
runs-on: ubuntu-latest
name: Clang Tidy
steps:
- uses: actions/checkout@v2.1.0
- name: build
env:
CC: clang
run: |
sudo apt-get install cmake clang-tidy
mkdir build-debug && cd build-debug
cmake .. -DCMAKE_C_FLAGS=-m32 -DSANITIZER=address
make -j
make check
ubuntu-32bit-undefined:
runs-on: ubuntu-latest
name: Clang Tidy
steps:
- uses: actions/checkout@v2.1.0
- name: build
env:
CC: clang
run: |
sudo apt-get install cmake clang-tidy
mkdir build-debug && cd build-debug
cmake .. -DCMAKE_C_FLAGS=-m32 -DSANITIZER=undefined
make -j
make check

View File

@ -5,8 +5,7 @@ set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
add_library(sc_array SHARED
sc_array.h)
add_library(sc_array SHARED sc_array.h)
set_target_properties(sc_array PROPERTIES LINKER_LANGUAGE C)

View File

@ -525,7 +525,7 @@ void fail_test()
sc_buf_term(&buf);
sc_buf_init(&buf, 0);
sc_buf_peek_data(&buf, 100, (unsigned char *) &p, 8);
sc_buf_peek_data(&buf, 100, (unsigned char *) &p, sizeof(p));
assert(sc_buf_valid(&buf) == false);
sc_buf_term(&buf);

View File

@ -24,7 +24,7 @@ if (SC_BUILD_TEST)
include(CTest)
include(CheckCCompilerFlag)
include (TestBigEndian)
include(TestBigEndian)
if (SC_CLANG_TIDY)
message(STATUS "Enabled CLANG_TIDY")
@ -43,9 +43,11 @@ if (SC_BUILD_TEST)
# detect x86
check_c_compiler_flag(-msse4.2 HAVE_CRC32_HARDWARE)
if (${HAVE_CRC32_HARDWARE})
message(STATUS "CPU have -msse4.2, defined HAVE_CRC32C")
target_compile_options(${PROJECT_NAME}_test PRIVATE -msse4.2)
target_compile_definitions(${PROJECT_NAME}_test PRIVATE -DHAVE_CRC32C)
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
message(STATUS "CPU have -msse4.2, defined HAVE_CRC32C")
target_compile_options(${PROJECT_NAME}_test PRIVATE -msse4.2)
target_compile_definitions(${PROJECT_NAME}_test PRIVATE -DHAVE_CRC32C)
endif ()
endif ()
# detect aarch64
@ -53,14 +55,14 @@ if (SC_BUILD_TEST)
message(STATUS "CPU = aarch64, defined HAVE_CRC32C, -march=armv8.1-a")
target_compile_definitions(${PROJECT_NAME}_test PRIVATE -DHAVE_CRC32C)
target_compile_options(${PROJECT_NAME}_test PRIVATE -march=armv8.1-a)
endif()
endif ()
# detect software version endianness
test_big_endian(HAVE_BIG_ENDIAN)
if (${HAVE_BIG_ENDIAN})
message(STATUS "System is BIG ENDIAN")
target_compile_definitions(${PROJECT_NAME}_test PRIVATE -DHAVE_BIG_ENDIAN)
else()
else ()
message(STATUS "System is LITTLE ENDIAN")
endif ()

View File

@ -10,8 +10,6 @@ add_library(
sc_map.c
sc_map.h)
add_executable(test_map sc_map.h sc_map.c map_example.c)
target_include_directories(sc_map PUBLIC ${CMAKE_CURRENT_LIST_DIR})
if (NOT CMAKE_C_COMPILER_ID MATCHES "MSVC")

View File

@ -144,8 +144,9 @@ int sc_sock_accept(struct sc_sock *s, struct sc_sock *in);
* @param dst_port destination port
* @param src_addr source addr (outgoing addr)
* @param src_port source port (outgoing port)
* @return '0' on success, negative number on failure.
* call sc_sock_error() for error string.
* @return '0' on success
* negative value if it is non-blocking, errno will be EAGAIN
* negative value on error, call sc_sock_error() error text.
*/
int sc_sock_connect(struct sc_sock *s, const char *dst_addr,
const char *dst_port, const char *src_addr,
@ -195,8 +196,8 @@ int sc_sock_finish_connect(struct sc_sock *s);
* @param len len
* @param flags normally should be zero, otherwise flags are passed to send().
* @return - on success, returns sent byte count.
* - SC_SOCK_WANT_WRITE on EAGAIN.
* - SC_SOCK_ERROR on error
* - negative value if it fails with errno = EAGAIN.
* - negative value on error
*/
int sc_sock_send(struct sc_sock *s, char *buf, int len, int flags);
@ -206,8 +207,8 @@ int sc_sock_send(struct sc_sock *s, char *buf, int len, int flags);
* @param len len
* @param flags normally should be zero, otherwise flags are passed to recv().
* @return - on success, returns bytes received.
* - SC_SOCK_WANT_READ on EAGAIN.
* - SC_SOCK_ERROR on error
* - negative value if it fails with errno = EAGAIN.
* - negative value on error
*/
int sc_sock_recv(struct sc_sock *s, char *buf, int len, int flags);