Skip to content

Commit 5433365

Browse files
committed
CMake: Move netsocket stubs to the netsocket dir
Move the connectivity netsocket stubs into the connectivity/netsocket component directory. So we can avoid duplicating the mbed-os source tree in a central UNITTESTS folder.
1 parent 69d1db9 commit 5433365

12 files changed

+29
-11
lines changed

UNITTESTS/stubs/NetworkStack_stub.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class NetworkStackstub : public NetworkStack {
4040
{
4141
}
4242

43-
virtual nsapi_error_t get_ip_address(SocketAddress* address)
43+
virtual nsapi_error_t get_ip_address(SocketAddress *address)
4444
{
4545
address->set_ip_address("127.0.0.1");
4646
return NSAPI_ERROR_OK;

UNITTESTS/stubs/connectivity/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,9 @@ target_compile_definitions(mbed-stubs-connectivity
1919
target_sources(mbed-stubs-connectivity
2020
PRIVATE
2121
aes_stub.c
22-
CellularInterface_stub.cpp
2322
cipher_stub.c
2423
cmac_stub.c
2524
ip4tos_stub.c
26-
MeshInterface_stub.cpp
27-
NetworkInterfaceDefaults_stub.cpp
28-
NetworkInterface_stub.cpp
29-
NetworkStack_stub.cpp
30-
nsapi_dns_stub.cpp
31-
SocketAddress_stub.cpp
32-
SocketStats_Stub.cpp
3325
stoip4_stub.c
3426
${mbed-os_SOURCE_DIR}/connectivity/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.c
3527
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright (c) 2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4+
add_subdirectory(doubles)
45
add_subdirectory(netsocket)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_library(mbed-stubs-netsocket)
5+
6+
target_sources(mbed-stubs-netsocket
7+
PRIVATE
8+
CellularInterface_stub.cpp
9+
MeshInterface_stub.cpp
10+
NetworkInterfaceDefaults_stub.cpp
11+
NetworkInterface_stub.cpp
12+
NetworkStack_stub.cpp
13+
nsapi_dns_stub.cpp
14+
SocketAddress_stub.cpp
15+
SocketStats_Stub.cpp
16+
)
17+
18+
target_link_libraries(mbed-stubs-netsocket
19+
PRIVATE
20+
mbed-stubs-rtos-headers
21+
mbed-headers
22+
mbed-stubs-headers
23+
mbed-stubs-rtos
24+
gtest
25+
)

UNITTESTS/stubs/connectivity/NetworkStack_stub.cpp renamed to connectivity/netsocket/tests/UNITTESTS/doubles/NetworkStack_stub.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ nsapi_error_t NetworkStack::call_in(int delay, mbed::Callback<void()> func)
9494
return NSAPI_ERROR_UNSUPPORTED;
9595
}
9696

97-
nsapi_error_t NetworkStack::get_ip_address(SocketAddress* address)
97+
nsapi_error_t NetworkStack::get_ip_address(SocketAddress *address)
9898
{
9999
return NSAPI_ERROR_UNSUPPORTED;
100100
}
@@ -104,7 +104,7 @@ nsapi_error_t NetworkStack::get_ipv6_link_local_address(SocketAddress *address)
104104
return NSAPI_ERROR_UNSUPPORTED;
105105
}
106106

107-
nsapi_error_t NetworkStack::get_ip_address_if(SocketAddress* address, const char *interface_name)
107+
nsapi_error_t NetworkStack::get_ip_address_if(SocketAddress *address, const char *interface_name)
108108
{
109109
return NSAPI_ERROR_UNSUPPORTED;
110110
}

0 commit comments

Comments
 (0)