diff --git a/UNITTESTS/stubs/connectivity/CMakeLists.txt b/UNITTESTS/stubs/connectivity/CMakeLists.txt index d3873c3295..51664425b3 100644 --- a/UNITTESTS/stubs/connectivity/CMakeLists.txt +++ b/UNITTESTS/stubs/connectivity/CMakeLists.txt @@ -7,8 +7,6 @@ target_compile_definitions(mbed-stubs-connectivity PRIVATE DEVICE_SERIAL=1 DEVICE_INTERRUPTIN=1 - MBED_CONF_CELLULAR_USE_SMS=1 - MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN=NULL MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200 MBED_CONF_LORA_OVER_THE_AIR_ACTIVATION=true MBED_CONF_LORA_AUTOMATIC_UPLINK_MESSAGE=true @@ -21,19 +19,7 @@ target_compile_definitions(mbed-stubs-connectivity target_sources(mbed-stubs-connectivity PRIVATE aes_stub.c - AT_CellularContext_stub.cpp - AT_CellularDevice_stub.cpp - AT_CellularInformation_stub.cpp - AT_CellularNetwork_stub.cpp - AT_CellularSMS_stub.cpp - AT_CellularStack_stub.cpp - AT_ControlPlane_netif_stub.cpp - ATHandler_stub.cpp - CellularContext_stub.cpp - CellularDevice_stub.cpp CellularInterface_stub.cpp - CellularStateMachine_stub.cpp - CellularUtil_stub.cpp cipher_stub.c cmac_stub.c ip4tos_stub.c diff --git a/connectivity/cellular/tests/UNITTESTS/CMakeLists.txt b/connectivity/cellular/tests/UNITTESTS/CMakeLists.txt index 7fa72fe29e..85de1e5d0c 100644 --- a/connectivity/cellular/tests/UNITTESTS/CMakeLists.txt +++ b/connectivity/cellular/tests/UNITTESTS/CMakeLists.txt @@ -1,4 +1,5 @@ # Copyright (c) 2021 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_subdirectory(doubles) add_subdirectory(framework) diff --git a/UNITTESTS/stubs/connectivity/ATHandler_stub.cpp b/connectivity/cellular/tests/UNITTESTS/doubles/ATHandler_stub.cpp similarity index 100% rename from UNITTESTS/stubs/connectivity/ATHandler_stub.cpp rename to connectivity/cellular/tests/UNITTESTS/doubles/ATHandler_stub.cpp diff --git a/UNITTESTS/stubs/connectivity/AT_CellularContext_stub.cpp b/connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularContext_stub.cpp similarity index 98% rename from UNITTESTS/stubs/connectivity/AT_CellularContext_stub.cpp rename to connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularContext_stub.cpp index 4078bc3567..87c9cc624a 100644 --- a/UNITTESTS/stubs/connectivity/AT_CellularContext_stub.cpp +++ b/connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularContext_stub.cpp @@ -171,7 +171,8 @@ bool AT_CellularContext::get_context() return true; } -const char* AT_CellularContext::get_nonip_context_type_str() { +const char *AT_CellularContext::get_nonip_context_type_str() +{ return "Non-IP"; } diff --git a/UNITTESTS/stubs/connectivity/AT_CellularDevice_stub.cpp b/connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularDevice_stub.cpp similarity index 100% rename from UNITTESTS/stubs/connectivity/AT_CellularDevice_stub.cpp rename to connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularDevice_stub.cpp diff --git a/UNITTESTS/stubs/connectivity/AT_CellularInformation_stub.cpp b/connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularInformation_stub.cpp similarity index 100% rename from UNITTESTS/stubs/connectivity/AT_CellularInformation_stub.cpp rename to connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularInformation_stub.cpp diff --git a/UNITTESTS/stubs/connectivity/AT_CellularNetwork_stub.cpp b/connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularNetwork_stub.cpp similarity index 100% rename from UNITTESTS/stubs/connectivity/AT_CellularNetwork_stub.cpp rename to connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularNetwork_stub.cpp diff --git a/UNITTESTS/stubs/connectivity/AT_CellularSMS_stub.cpp b/connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularSMS_stub.cpp similarity index 100% rename from UNITTESTS/stubs/connectivity/AT_CellularSMS_stub.cpp rename to connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularSMS_stub.cpp diff --git a/UNITTESTS/stubs/connectivity/AT_CellularStack_stub.cpp b/connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularStack_stub.cpp similarity index 97% rename from UNITTESTS/stubs/connectivity/AT_CellularStack_stub.cpp rename to connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularStack_stub.cpp index f6187bd8d6..26d7901a1e 100644 --- a/UNITTESTS/stubs/connectivity/AT_CellularStack_stub.cpp +++ b/connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularStack_stub.cpp @@ -31,7 +31,7 @@ AT_CellularStack::~AT_CellularStack() { } -nsapi_error_t AT_CellularStack::get_ip_address(SocketAddress* address) +nsapi_error_t AT_CellularStack::get_ip_address(SocketAddress *address) { return NSAPI_ERROR_UNSUPPORTED; } diff --git a/UNITTESTS/stubs/connectivity/AT_ControlPlane_netif_stub.cpp b/connectivity/cellular/tests/UNITTESTS/doubles/AT_ControlPlane_netif_stub.cpp similarity index 100% rename from UNITTESTS/stubs/connectivity/AT_ControlPlane_netif_stub.cpp rename to connectivity/cellular/tests/UNITTESTS/doubles/AT_ControlPlane_netif_stub.cpp diff --git a/connectivity/cellular/tests/UNITTESTS/doubles/CMakeLists.txt b/connectivity/cellular/tests/UNITTESTS/doubles/CMakeLists.txt new file mode 100644 index 0000000000..a219d26ca0 --- /dev/null +++ b/connectivity/cellular/tests/UNITTESTS/doubles/CMakeLists.txt @@ -0,0 +1,39 @@ +# Copyright (c) 2021 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +add_library(mbed-stubs-cellular) + +target_compile_definitions(mbed-stubs-cellular + PRIVATE + DEVICE_SERIAL=1 + DEVICE_INTERRUPTIN=1 + MBED_CONF_CELLULAR_USE_SMS=1 + MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN=NULL + MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200 + MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32 + MDMTXD=NC + MDMRXD=NC +) + +target_sources(mbed-stubs-cellular + PRIVATE + AT_CellularContext_stub.cpp + AT_CellularDevice_stub.cpp + AT_CellularInformation_stub.cpp + AT_CellularNetwork_stub.cpp + AT_CellularSMS_stub.cpp + AT_CellularStack_stub.cpp + AT_ControlPlane_netif_stub.cpp + ATHandler_stub.cpp + CellularContext_stub.cpp + CellularDevice_stub.cpp + CellularStateMachine_stub.cpp + CellularUtil_stub.cpp +) + +target_link_libraries(mbed-stubs-cellular + PRIVATE + mbed-headers + mbed-stubs-headers + gtest +) diff --git a/UNITTESTS/stubs/connectivity/CellularContext_stub.cpp b/connectivity/cellular/tests/UNITTESTS/doubles/CellularContext_stub.cpp similarity index 100% rename from UNITTESTS/stubs/connectivity/CellularContext_stub.cpp rename to connectivity/cellular/tests/UNITTESTS/doubles/CellularContext_stub.cpp diff --git a/UNITTESTS/stubs/connectivity/CellularDevice_stub.cpp b/connectivity/cellular/tests/UNITTESTS/doubles/CellularDevice_stub.cpp similarity index 100% rename from UNITTESTS/stubs/connectivity/CellularDevice_stub.cpp rename to connectivity/cellular/tests/UNITTESTS/doubles/CellularDevice_stub.cpp diff --git a/UNITTESTS/stubs/connectivity/CellularStateMachine_stub.cpp b/connectivity/cellular/tests/UNITTESTS/doubles/CellularStateMachine_stub.cpp similarity index 100% rename from UNITTESTS/stubs/connectivity/CellularStateMachine_stub.cpp rename to connectivity/cellular/tests/UNITTESTS/doubles/CellularStateMachine_stub.cpp diff --git a/UNITTESTS/stubs/connectivity/CellularUtil_stub.cpp b/connectivity/cellular/tests/UNITTESTS/doubles/CellularUtil_stub.cpp similarity index 100% rename from UNITTESTS/stubs/connectivity/CellularUtil_stub.cpp rename to connectivity/cellular/tests/UNITTESTS/doubles/CellularUtil_stub.cpp diff --git a/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularcontext/CMakeLists.txt b/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularcontext/CMakeLists.txt index ffc33cb516..a39933bdfe 100644 --- a/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularcontext/CMakeLists.txt +++ b/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularcontext/CMakeLists.txt @@ -25,6 +25,7 @@ target_link_libraries(${TEST_NAME} PRIVATE mbed-headers mbed-stubs + mbed-stubs-cellular mbed-stubs-headers mbed-stubs-rtos-headers gmock_main diff --git a/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellulardevice/CMakeLists.txt b/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellulardevice/CMakeLists.txt index 1440432357..4e9db7879a 100644 --- a/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellulardevice/CMakeLists.txt +++ b/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellulardevice/CMakeLists.txt @@ -31,6 +31,7 @@ target_link_libraries(${TEST_NAME} PRIVATE mbed-headers mbed-stubs + mbed-stubs-cellular mbed-stubs-headers mbed-stubs-rtos gmock_main diff --git a/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularinformation/CMakeLists.txt b/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularinformation/CMakeLists.txt index b7a6ec83f7..c75fb803a9 100644 --- a/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularinformation/CMakeLists.txt +++ b/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularinformation/CMakeLists.txt @@ -23,6 +23,7 @@ target_link_libraries(${TEST_NAME} PRIVATE mbed-headers mbed-stubs + mbed-stubs-cellular mbed-stubs-headers gmock_main ) diff --git a/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularnetwork/CMakeLists.txt b/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularnetwork/CMakeLists.txt index 70d33ecdc0..8c00587a31 100644 --- a/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularnetwork/CMakeLists.txt +++ b/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularnetwork/CMakeLists.txt @@ -24,6 +24,7 @@ target_link_libraries(${TEST_NAME} PRIVATE mbed-headers mbed-stubs + mbed-stubs-cellular mbed-stubs-headers gmock_main ) diff --git a/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularsms/CMakeLists.txt b/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularsms/CMakeLists.txt index 2f62b64f8d..7a19d17f0c 100644 --- a/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularsms/CMakeLists.txt +++ b/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularsms/CMakeLists.txt @@ -24,6 +24,7 @@ target_link_libraries(${TEST_NAME} PRIVATE mbed-headers mbed-stubs + mbed-stubs-cellular mbed-stubs-headers gmock_main ) diff --git a/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularstack/CMakeLists.txt b/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularstack/CMakeLists.txt index ec71a7eaa8..a300cb2876 100644 --- a/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularstack/CMakeLists.txt +++ b/connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularstack/CMakeLists.txt @@ -29,6 +29,7 @@ target_link_libraries(${TEST_NAME} PRIVATE mbed-headers mbed-stubs + mbed-stubs-cellular mbed-stubs-headers mbed-stubs-rtos-headers gmock_main diff --git a/connectivity/cellular/tests/UNITTESTS/framework/device/athandler/CMakeLists.txt b/connectivity/cellular/tests/UNITTESTS/framework/device/athandler/CMakeLists.txt index 9ea7f08523..b75ac977b0 100644 --- a/connectivity/cellular/tests/UNITTESTS/framework/device/athandler/CMakeLists.txt +++ b/connectivity/cellular/tests/UNITTESTS/framework/device/athandler/CMakeLists.txt @@ -25,6 +25,7 @@ target_link_libraries(${TEST_NAME} PRIVATE mbed-headers mbed-stubs + mbed-stubs-cellular mbed-stubs-headers gmock_main ) diff --git a/connectivity/cellular/tests/UNITTESTS/framework/device/cellularcontext/CMakeLists.txt b/connectivity/cellular/tests/UNITTESTS/framework/device/cellularcontext/CMakeLists.txt index c774d6ce2e..0e2cc73d68 100644 --- a/connectivity/cellular/tests/UNITTESTS/framework/device/cellularcontext/CMakeLists.txt +++ b/connectivity/cellular/tests/UNITTESTS/framework/device/cellularcontext/CMakeLists.txt @@ -37,6 +37,7 @@ target_link_libraries(${TEST_NAME} PRIVATE mbed-headers mbed-stubs + mbed-stubs-cellular mbed-stubs-headers gmock_main ) diff --git a/connectivity/cellular/tests/UNITTESTS/framework/device/cellulardevice/CMakeLists.txt b/connectivity/cellular/tests/UNITTESTS/framework/device/cellulardevice/CMakeLists.txt index b903eb0868..d01158d6f9 100644 --- a/connectivity/cellular/tests/UNITTESTS/framework/device/cellulardevice/CMakeLists.txt +++ b/connectivity/cellular/tests/UNITTESTS/framework/device/cellulardevice/CMakeLists.txt @@ -29,6 +29,7 @@ target_link_libraries(${TEST_NAME} PRIVATE mbed-headers mbed-stubs + mbed-stubs-cellular mbed-stubs-headers gmock_main ) diff --git a/connectivity/cellular/tests/UNITTESTS/framework/device/cellularstatemachine/CMakeLists.txt b/connectivity/cellular/tests/UNITTESTS/framework/device/cellularstatemachine/CMakeLists.txt index 4412d70970..11bfb940ca 100644 --- a/connectivity/cellular/tests/UNITTESTS/framework/device/cellularstatemachine/CMakeLists.txt +++ b/connectivity/cellular/tests/UNITTESTS/framework/device/cellularstatemachine/CMakeLists.txt @@ -30,6 +30,7 @@ target_link_libraries(${TEST_NAME} PRIVATE mbed-headers mbed-stubs + mbed-stubs-cellular mbed-stubs-headers mbed-stubs-rtos-headers gmock_main diff --git a/connectivity/netsocket/tests/UNITTESTS/netsocket/CellularNonIPSocket/CMakeLists.txt b/connectivity/netsocket/tests/UNITTESTS/netsocket/CellularNonIPSocket/CMakeLists.txt index cc1022d152..bd65504c8c 100644 --- a/connectivity/netsocket/tests/UNITTESTS/netsocket/CellularNonIPSocket/CMakeLists.txt +++ b/connectivity/netsocket/tests/UNITTESTS/netsocket/CellularNonIPSocket/CMakeLists.txt @@ -24,6 +24,7 @@ target_link_libraries(${TEST_NAME} PRIVATE mbed-headers mbed-stubs + mbed-stubs-cellular mbed-stubs-headers gmock_main )