Skip to content

Commit

Permalink
Merge pull request #14920 from hazzlim/refactor-connectivity-netsocke…
Browse files Browse the repository at this point in the history
…t-unittests

Refactor connectivity netsocket unittests
  • Loading branch information
0xc0170 authored Jul 20, 2021
2 parents 2181d7c + 14cab32 commit 146c98c
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ target_sources(${TEST_NAME}

target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-headers-events
mbed-headers-drivers
mbed-headers-rtos
mbed-headers-netsocket
mbed-headers-cellular
mbed-stubs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,26 @@ set(TEST_NAME netsocket-dtls-socket-unittest)
add_executable(${TEST_NAME})

target_compile_definitions(${TEST_NAME}
PRIVATE
PRIVATE
MBED_CONF_NSAPI_DNS_ADDRESSES_LIMIT=10
)

target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/SocketAddress.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkStack.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/InternetSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/InternetDatagramSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/UDPSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/DTLSSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/DTLSSocketWrapper.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/TLSSocketWrapper.cpp
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/ip4tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/ip6tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/stoip4.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/stoip6.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
test_DTLSSocket.cpp
)

target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-headers-events
mbed-headers-drivers
mbed-headers-rtos
mbed-headers-nanostack-libservice
mbed-headers-mbedtls
mbed-headers-netsocket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,25 @@ set(TEST_NAME netsocket-dtls-socket-wrapper-unittest)
add_executable(${TEST_NAME})

target_compile_definitions(${TEST_NAME}
PRIVATE
PRIVATE
MBED_CONF_NSAPI_DNS_ADDRESSES_LIMIT=10
)

target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/SocketAddress.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkStack.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/InternetSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/InternetDatagramSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/UDPSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/DTLSSocketWrapper.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/TLSSocketWrapper.cpp
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/ip4tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/ip6tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/stoip4.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/stoip6.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
test_DTLSSocketWrapper.cpp
)

target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-headers-events
mbed-headers-drivers
mbed-headers-rtos
mbed-headers-nanostack-libservice
mbed-headers-mbedtls
mbed-headers-netsocket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(TEST_NAME netsocket-ethernet-interface-unittest)
add_executable(${TEST_NAME})

target_compile_definitions(${TEST_NAME}
PRIVATE
PRIVATE
MBED_CONF_NSAPI_DNS_ADDRESSES_LIMIT=10
)

Expand All @@ -15,23 +15,21 @@ target_sources(${TEST_NAME}
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/SocketAddress.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/EthernetInterface.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/EMACInterface.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkInterface.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkStack.cpp
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/ip4tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/ip6tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/stoip4.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/stoip6.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libList/ns_list.c
test_EthernetInterface.cpp
)

target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers-drivers
mbed-headers-rtos
mbed-headers-nanostack-libservice
mbed-headers-mbedtls
mbed-headers-netsocket
mbed-headers
mbed-stubs
mbed-stubs-headers
mbed-stubs-netsocket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(TEST_NAME netsocket-iface-dns-socket-unittest)
add_executable(${TEST_NAME})

target_compile_definitions(${TEST_NAME}
PRIVATE
PRIVATE
MBED_CONF_NSAPI_DNS_ADDRESSES_LIMIT=10
DEVICE_EMAC
MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE=ETHERNET
Expand All @@ -20,13 +20,10 @@ target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/SocketAddress.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkInterface.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkInterfaceDefaults.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkStack.cpp #nsapi_create_stack
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/InternetSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/TCPSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/InternetDatagramSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/UDPSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/SocketStats.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/EthernetInterface.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/EMACInterface.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/nsapi_dns.cpp
Expand All @@ -35,14 +32,15 @@ target_sources(${TEST_NAME}
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/stoip4.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/stoip6.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libList/ns_list.c
moduletest.cpp
)

target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-headers-events
mbed-headers-drivers
mbed-headers-rtos
mbed-headers-nanostack-libservice
mbed-headers-mbedtls
mbed-headers-netsocket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,30 @@ set(TEST_NAME netsocket-internet-socket-unittest)
add_executable(${TEST_NAME})

target_compile_definitions(${TEST_NAME}
PRIVATE
PRIVATE
MBED_CONF_NSAPI_DNS_ADDRESSES_LIMIT=10
)

target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/SocketAddress.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkStack.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/InternetSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/ip4tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/ip6tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/stoip4.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/stoip6.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
test_InternetSocket.cpp
)

target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-headers-drivers
mbed-headers-rtos
mbed-headers-nanostack-libservice
mbed-headers-netsocket
mbed-stubs
mbed-stubs-headers
mbed-stubs-netsocket
mbed-stubs-nanostack-libservice
gmock_main
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,21 @@ set(TEST_NAME netsocket-network-interface-unittest)
add_executable(${TEST_NAME})

target_compile_definitions(${TEST_NAME}
PRIVATE
PRIVATE
MBED_CONF_PLATFORM_CALLBACK_COMPARABLE
MBED_CONF_NSAPI_DNS_ADDRESSES_LIMIT=10

)

target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/SocketAddress.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkStack.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkInterface.cpp
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/ip4tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/ip6tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/stoip4.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/stoip6.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libList/ns_list.c
test_NetworkInterface.cpp
)

target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-headers-nanostack-libservice
mbed-headers-netsocket
mbed-stubs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ add_executable(${TEST_NAME})

target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_NSAPI_DNS_ADDRESSES_LIMIT=10
MBED_CONF_NSAPI_DNS_ADDRESSES_LIMIT=10
)

target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/SocketAddress.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkStack.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkStack.cpp
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/ip4tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/ip6tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/stoip4.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/stoip6.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
test_NetworkStack.cpp
)

target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-headers-events
mbed-headers-nanostack-libservice
mbed-headers-netsocket
mbed-stubs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,18 @@ target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/SocketAddress.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/PPPInterface.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/EMACInterface.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkInterface.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkStack.cpp
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/ip4tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/ip6tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/stoip4.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/stoip6.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libList/ns_list.c
test_PPPInterface.cpp
)

target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-headers-drivers
mbed-headers-rtos
mbed-headers-nanostack-libservice
mbed-headers-mbedtls
mbed-headers-netsocket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ target_sources(${TEST_NAME}
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/ip6tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/stoip4.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/stoip6.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
test_SocketAddress.cpp
)

target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-headers-nanostack-libservice
mbed-headers-netsocket
mbed-stubs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,24 @@ target_compile_definitions(${TEST_NAME}
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/SocketAddress.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkStack.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/InternetSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/TCPSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/ip4tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/ip6tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/stoip4.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/stoip6.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
test_TCPSocket.cpp
)

target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-headers-drivers
mbed-headers-rtos
mbed-headers-nanostack-libservice
mbed-headers-netsocket
mbed-stubs
mbed-stubs-headers
mbed-stubs-netsocket
mbed-stubs-nanostack-libservice
gmock_main
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,18 @@ target_compile_definitions(${TEST_NAME}

target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/SocketAddress.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkStack.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/InternetSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/TCPSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/TLSSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/TLSSocketWrapper.cpp
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/ip4tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/ip6tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/stoip4.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/stoip6.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
test_TLSSocket.cpp
)

target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-headers-events
mbed-headers-drivers
mbed-headers-rtos
mbed-headers-nanostack-libservice
mbed-headers-mbedtls
mbed-headers-netsocket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ target_compile_definitions(${TEST_NAME}
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/SocketAddress.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/NetworkStack.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/InternetSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/TCPSocket.cpp
${mbed-os_SOURCE_DIR}/connectivity/netsocket/source/TLSSocketWrapper.cpp
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/ip4tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/ip6tos.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip4string/stoip4.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libip6string/stoip6.c
${mbed-os_SOURCE_DIR}/connectivity/libraries/nanostack-libservice/source/libBits/common_functions.c
test_TLSSocketWrapper.cpp
)

target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-headers-events
mbed-headers-drivers
mbed-headers-rtos
mbed-headers-nanostack-libservice
mbed-headers-mbedtls
mbed-headers-netsocket
mbed-stubs
mbed-stubs-headers
mbed-stubs-mbedtls
mbed-stubs-netsocket
mbed-stubs-nanostack-libservice
gmock_main
)

Expand Down
Loading

0 comments on commit 146c98c

Please sign in to comment.