From b6ebfeea2c82c4c7f6b22ced1228ea0932f63d44 Mon Sep 17 00:00:00 2001 From: Kimmo Vaisanen Date: Thu, 3 Oct 2019 09:27:12 +0300 Subject: [PATCH] Cellular: Remove old deprecated tests Cellular tests have been replaced with generic mbed-os netsocket and network interface tests. --- TESTS/netsocket/README.md | 61 +++- features/cellular/README.md | 17 +- .../TESTS/api/cellular_device/main.cpp | 221 --------------- .../TESTS/api/cellular_information/main.cpp | 117 -------- .../TESTS/api/cellular_network/main.cpp | 251 ----------------- .../cellular/TESTS/api/cellular_sms/main.cpp | 261 ------------------ .../cellular/TESTS/cellular_tests_common.h | 66 ----- features/cellular/TESTS/socket/udp/main.cpp | 217 --------------- .../socket/udp/template_mbed_app.json.txt | 47 ---- features/cellular/junit_xsl.xslt | 101 ------- features/cellular/xsl_script.sh | 35 --- 11 files changed, 61 insertions(+), 1333 deletions(-) delete mode 100644 features/cellular/TESTS/api/cellular_device/main.cpp delete mode 100644 features/cellular/TESTS/api/cellular_information/main.cpp delete mode 100644 features/cellular/TESTS/api/cellular_network/main.cpp delete mode 100644 features/cellular/TESTS/api/cellular_sms/main.cpp delete mode 100644 features/cellular/TESTS/cellular_tests_common.h delete mode 100644 features/cellular/TESTS/socket/udp/main.cpp delete mode 100644 features/cellular/TESTS/socket/udp/template_mbed_app.json.txt delete mode 100644 features/cellular/junit_xsl.xslt delete mode 100755 features/cellular/xsl_script.sh diff --git a/TESTS/netsocket/README.md b/TESTS/netsocket/README.md index 8cab4dd513..350ecbfcf7 100644 --- a/TESTS/netsocket/README.md +++ b/TESTS/netsocket/README.md @@ -386,10 +386,18 @@ Wi-Fi tests require some more configuration, so for Wi-Fi purposes, the `mbed_ap "echo-server-port" : { "help" : "Port of echo server", "value" : "7" - } + }, + "echo-server-discard-port" : { + "help" : "Discard port of echo server", + "value" : "9" + }, "echo-server-port-tls" : { - "help" : "Port of echo server TLS", + "help" : "Port of echo server for TLS", "value" : "2007" + }, + "echo-server-discard-port-tls" : { + "help" : "Discard port of echo server for TLS", + "value" : "2009" } }, "target_overrides": { @@ -403,7 +411,54 @@ Wi-Fi tests require some more configuration, so for Wi-Fi purposes, the `mbed_ap } ``` -Please, see `mbed-os/tools/test_configs` folder for examples. +Cellular tests require some more configuration, so for cellular purposes, the `mbed_app.json` might look like this: +NOTE! These are just typical settings needed for cellular. Actual configuration values depend on used target HW, SIM, modem and network capabilities. + +``` +{ + "config": { + "echo-server-addr" : { + "help" : "IP address of echo server", + "value" : "\"echo.mbedcloudtesting.com\"" + }, + "echo-server-port" : { + "help" : "Port of echo server", + "value" : "7" + }, + "echo-server-discard-port" : { + "help" : "Discard port of echo server", + "value" : "9" + }, + "echo-server-port-tls" : { + "help" : "Port of echo server for TLS", + "value" : "2007" + }, + "echo-server-discard-port-tls" : { + "help" : "Discard port of echo server for TLS", + "value" : "2009" + } + }, + "target_overrides": { + "*": { + "target.network-default-interface-type": "CELLULAR", + "nsapi.default-cellular-sim-pin": "\"SIM PIN if needed\"", + "nsapi.default-cellular-plmn": "\"PLMN if needed\"", + "nsapi.default-cellular-apn": "\"APN if needed\"", + "nsapi.default-cellular-username": "\"SIM USERNAME if needed\"", + "nsapi.default-cellular-password": "\"SIM PASSWORD if needed\"", + "lwip.ipv4-enabled": true, + "lwip.ipv6-enabled": true, + "lwip.tcp-enabled": true, + "lwip.ppp-enabled": true, + "lwip.ethernet-enabled": false, + ".provide-default": true, + "cellular.radio-access-technology": + } + } +} +``` + +Please, see `mbed-os/tools/test_configs` folder for examples for different technologies. Now build the test binaries: diff --git a/features/cellular/README.md b/features/cellular/README.md index 97f1ba0b14..f8bd927eb5 100644 --- a/features/cellular/README.md +++ b/features/cellular/README.md @@ -9,8 +9,6 @@ This is the Github repo for Mbed cellular connectivity: device Implementation of cellular device and state machine targets Vendor specific cellular module adaptations - TESTS Cellular Greentea test - **Note:** Application developers should use only the `API` folder. ## Known limitations @@ -28,6 +26,7 @@ You can change cellular defaults in the `mbed_lib.json` configuration file. ## Debug traces You can define the debug tracing level in the `mbed_app.json` configuration file: + ``` "target_overrides": { "*": { @@ -48,18 +47,8 @@ You can define the debug tracing level in the `mbed_app.json` configuration file ## Greentea tests -The `TESTS` folder contains Greentea tests for cellular specific classes. You need to give relevant configuration file with `--app-config` parameter, such as: - -``` -mbed test -n features-cellular-tests-* --app-config features\cellular\TESTS\socket\udp\template_mbed_app.json.txt -v -``` - -**Note:** Greentea tests use SIM PIN, so you need to change that or your SIM card may get locked. +Cellular connectivity can be tested with generic Mbed OS netsocket and network interface tests found in Mbed OS root `TESTS` directory. For more information, see `TESTS/netsocket/README.md` and `TESTS/network/interface/README.md`. ## Unit tests -Cellular unit tests are in Mbed OS root `UNITTESTS`. Unit tests are based on the stubbing method. - -You need the following applications: `cpputest`, `gcov` and `lcov` (genhtml) for running the tests. - -After you run the `run_tests` script, you can find test results in `UNITTESTS/results`, and line and function coverages in `UNITTESTS/coverages`. +Cellular unit tests are in Mbed OS root `UNITTESTS/features/cellular`. diff --git a/features/cellular/TESTS/api/cellular_device/main.cpp b/features/cellular/TESTS/api/cellular_device/main.cpp deleted file mode 100644 index d471f17613..0000000000 --- a/features/cellular/TESTS/api/cellular_device/main.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (c) 2018, Arm Limited and affiliates. - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#if !defined(MBED_CONF_NSAPI_PRESENT) || !defined(MBED_CONF_APP_CELLULAR_SIM_PIN) -#error [NOT_SUPPORTED] A json configuration file is needed & SIM pin code is needed. Skipping this build. -#else - - -#include "greentea-client/test_env.h" -#include "unity.h" -#include "utest.h" - -#include "mbed.h" - -#include "CellularLog.h" -#include "CellularDevice.h" -#include "Semaphore.h" -#include "../../cellular_tests_common.h" - -static CellularDevice *device; -static rtos::Semaphore semaphore; - - -const int TIME_OUT_DEVICE_READY = 5 * 60 * 1000; // 5 minutes -const int TIME_OUT_REGISTER = 10 * 60 * 1000; // 10 minutes - -enum CurrentOp { - OP_DEVICE_READY, - OP_SIM_READY, - OP_REGISTER, - OP_ATTACH -}; -static CurrentOp op; - -static void create_device() -{ - device = CellularDevice::get_default_instance(); - TEST_ASSERT(device != NULL); -} - -static void open_close_interfaces() -{ - CellularNetwork *nw = device->open_network(); - TEST_ASSERT(nw != NULL); - device->close_network(); - - CellularInformation *info = device->open_information(); - TEST_ASSERT(info != NULL); - device->close_information(); - - CellularSMS *sms = device->open_sms(); - TEST_ASSERT(sms != NULL); - device->close_sms(); - - CellularContext *ctx = device->create_context(); - TEST_ASSERT(ctx != NULL); - TEST_ASSERT(device->get_context_list() == ctx); - device->delete_context(ctx); -} - -static void other_methods() -{ - // test first without any open interfaces - device->set_timeout(5000); - device->modem_debug_on(true); - device->modem_debug_on(false); - - CellularNetwork *nw = device->open_network(); - TEST_ASSERT(nw != NULL); - - // then test with open interface which is called - device->set_timeout(5000); - device->modem_debug_on(true); - device->modem_debug_on(false); - - TEST_ASSERT(device->get_queue() != NULL); - TEST_ASSERT(device->hard_power_on() == NSAPI_ERROR_OK); - TEST_ASSERT(device->soft_power_on() == NSAPI_ERROR_OK); - wait(10); - TEST_ASSERT_EQUAL_INT(device->init(), NSAPI_ERROR_OK); -} - -static void shutdown() -{ - TEST_ASSERT(device->shutdown() == NSAPI_ERROR_OK); - TEST_ASSERT(device->soft_power_off() == NSAPI_ERROR_OK); - TEST_ASSERT(device->hard_power_off() == NSAPI_ERROR_OK); -} - -static void callback_func(nsapi_event_t ev, intptr_t ptr) -{ - if (ev >= NSAPI_EVENT_CELLULAR_STATUS_BASE && ev <= NSAPI_EVENT_CELLULAR_STATUS_END) { - cell_callback_data_t *ptr_data = (cell_callback_data_t *)ptr; - cellular_connection_status_t cell_ev = (cellular_connection_status_t)ev; - if (cell_ev == CellularDeviceReady && ptr_data->error == NSAPI_ERROR_OK && op == OP_DEVICE_READY) { - TEST_ASSERT_EQUAL_INT(semaphore.release(), osOK); - } else if (cell_ev == CellularSIMStatusChanged && ptr_data->error == NSAPI_ERROR_OK && - ptr_data->status_data == CellularDevice::SimStateReady && op == OP_SIM_READY) { - TEST_ASSERT_EQUAL_INT(semaphore.release(), osOK); - } else if (cell_ev == CellularRegistrationStatusChanged && - (ptr_data->status_data == CellularNetwork::RegisteredHomeNetwork || - ptr_data->status_data == CellularNetwork::RegisteredRoaming || - ptr_data->status_data == CellularNetwork::AlreadyRegistered) && - ptr_data->error == NSAPI_ERROR_OK && - op == OP_REGISTER) { - TEST_ASSERT_EQUAL_INT(semaphore.release(), osOK); - } else if (cell_ev == CellularAttachNetwork && ptr_data->status_data == CellularNetwork::Attached && - ptr_data->error == NSAPI_ERROR_OK && op == OP_ATTACH) { - TEST_ASSERT_EQUAL_INT(semaphore.release(), osOK); - } - } -} - -static void init_to_device_ready_state() -{ - device = CellularDevice::get_default_instance(); - TEST_ASSERT(device != NULL); - -#ifdef MBED_CONF_APP_CELLULAR_SIM_PIN - device->set_sim_pin(MBED_CONF_APP_CELLULAR_SIM_PIN); -#endif -#ifdef MBED_CONF_APP_CELLULAR_PLMN - device->set_plmn(MBED_CONF_APP_CELLULAR_PLMN); -#endif - device->attach(&callback_func); - - op = OP_DEVICE_READY; - TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, device->hard_power_on()); - TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, device->soft_power_on()); - TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, device->init()); - TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, device->set_device_ready()); - - int sema_err = semaphore.wait(TIME_OUT_DEVICE_READY); - TEST_ASSERT_EQUAL_INT(1, sema_err); -} - -static void continue_to_sim_ready_state() -{ - op = OP_SIM_READY; - TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, device->set_sim_ready()); - - int sema_err = semaphore.wait(TIME_OUT_DEVICE_READY); - TEST_ASSERT_EQUAL_INT(1, sema_err); -} - -static void continue_to_register_state() -{ - op = OP_REGISTER; - TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, device->register_to_network()); - - int sema_err = semaphore.wait(TIME_OUT_REGISTER); // cellular network searching may take several minutes - TEST_ASSERT_EQUAL_INT(1, sema_err); -} - -static void continue_to_attach_state() -{ - op = OP_ATTACH; - TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, device->attach_to_network()); - - int sema_err = semaphore.wait(TIME_OUT_REGISTER); // cellular network attach may take several minutes - TEST_ASSERT_EQUAL_INT(1, sema_err); -} - -using namespace utest::v1; - -static utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) -{ -#if MBED_CONF_MBED_TRACE_ENABLE - trace_close(); -#endif - greentea_case_failure_abort_handler(source, reason); - return STATUS_ABORT; -} - -static Case cases[] = { - Case("CellularDevice create device", create_device, greentea_failure_handler), - Case("CellularDevice Open and close interfaces", open_close_interfaces, greentea_failure_handler), - Case("CellularDevice other methods", other_methods, greentea_failure_handler), - Case("CellularDevice init to device ready", init_to_device_ready_state, greentea_failure_handler), - Case("CellularDevice sim ready", continue_to_sim_ready_state, greentea_failure_handler), - Case("CellularDevice register", continue_to_register_state, greentea_failure_handler), - Case("CellularDevice attach", continue_to_attach_state, greentea_failure_handler), - Case("CellularDevice shutdown", shutdown, greentea_failure_handler), -}; - -static utest::v1::status_t test_setup(const size_t number_of_cases) -{ - GREENTEA_SETUP(10 * 60, "default_auto"); - return verbose_test_setup_handler(number_of_cases); -} - -static Specification specification(test_setup, cases); - -int main() -{ -#if MBED_CONF_MBED_TRACE_ENABLE - trace_open(); -#endif - - int ret = Harness::run(specification); -#if MBED_CONF_MBED_TRACE_ENABLE - trace_close(); -#endif - return ret; -} - -#endif !defined(MBED_CONF_NSAPI_PRESENT) || !defined(MBED_CONF_APP_CELLULAR_SIM_PIN) diff --git a/features/cellular/TESTS/api/cellular_information/main.cpp b/features/cellular/TESTS/api/cellular_information/main.cpp deleted file mode 100644 index 2989782329..0000000000 --- a/features/cellular/TESTS/api/cellular_information/main.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2018, Arm Limited and affiliates. - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#if !defined(MBED_CONF_NSAPI_PRESENT) || !defined(MBED_CONF_APP_CELLULAR_SIM_PIN) -#error [NOT_SUPPORTED] A json configuration file is needed & SIM pin code is needed. Skipping this build. -#else - -#include "CellularUtil.h" // for CELLULAR_ helper macros - -#include "greentea-client/test_env.h" -#include "unity.h" -#include "utest.h" - -#include "mbed.h" - - -#include "AT_CellularInformation.h" -#include "CellularContext.h" -#include "CellularDevice.h" -#include "../../cellular_tests_common.h" - -static CellularContext *ctx; - -static void init_to_sim_state() -{ - ctx = CellularContext::get_default_instance(); - TEST_ASSERT(ctx != NULL); - ctx->set_sim_pin(MBED_CONF_APP_CELLULAR_SIM_PIN); -#ifdef MBED_CONF_APP_APN - ctx->set_credentials(MBED_CONF_APP_APN); -#endif - TEST_ASSERT(ctx->set_sim_ready() == NSAPI_ERROR_OK); -} - -static void test_information_interface() -{ - CellularDevice *dev = CellularDevice::get_default_instance(); - - CellularInformation *info = dev->open_information(); - const int kbuf_size = 100; - char *buf = new char[kbuf_size]; - - TEST_ASSERT(info->get_manufacturer(buf, kbuf_size) == NSAPI_ERROR_OK); - TEST_ASSERT(info->get_model(buf, kbuf_size) == NSAPI_ERROR_OK); - TEST_ASSERT(info->get_revision(buf, kbuf_size) == NSAPI_ERROR_OK); - TEST_ASSERT((info->get_serial_number(buf, kbuf_size, CellularInformation::SN) == NSAPI_ERROR_OK) || - ((((AT_CellularInformation *)info)->get_device_error().errType == 3) && // 3 == CME error from the modem - (((AT_CellularInformation *)info)->get_device_error().errCode == 4))); // 4 == "operation not supported" - - nsapi_error_t err = info->get_serial_number(buf, kbuf_size, CellularInformation::IMEI); - TEST_ASSERT(err == NSAPI_ERROR_UNSUPPORTED || err == NSAPI_ERROR_OK); - - err = info->get_serial_number(buf, kbuf_size, CellularInformation::IMEISV); - TEST_ASSERT(err == NSAPI_ERROR_UNSUPPORTED || err == NSAPI_ERROR_OK); - - err = info->get_serial_number(buf, kbuf_size, CellularInformation::SVN); - TEST_ASSERT(err == NSAPI_ERROR_UNSUPPORTED || err == NSAPI_ERROR_OK); - - err = info->get_imsi(buf, kbuf_size); - TEST_ASSERT(err == NSAPI_ERROR_UNSUPPORTED || err == NSAPI_ERROR_OK); - - err = info->get_iccid(buf, kbuf_size); - TEST_ASSERT(err == NSAPI_ERROR_UNSUPPORTED || err == NSAPI_ERROR_OK); - - dev->close_information(); - - delete [] buf; -} - -using namespace utest::v1; - -static utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) -{ - greentea_case_failure_abort_handler(source, reason); - return STATUS_ABORT; -} - -static Case cases[] = { - Case("CellularInformation init", init_to_sim_state, greentea_failure_handler), - Case("CellularInformation test interface", test_information_interface, greentea_failure_handler) -}; - -static utest::v1::status_t test_setup(const size_t number_of_cases) -{ - GREENTEA_SETUP(10 * 60, "default_auto"); - return verbose_test_setup_handler(number_of_cases); -} - -static Specification specification(test_setup, cases); - -int main() -{ -#if MBED_CONF_MBED_TRACE_ENABLE - trace_open(); -#endif - int ret = Harness::run(specification); -#if MBED_CONF_MBED_TRACE_ENABLE - trace_close(); -#endif - return ret; -} -#endif // !defined(MBED_CONF_NSAPI_PRESENT) || !defined(MBED_CONF_APP_CELLULAR_SIM_PIN) diff --git a/features/cellular/TESTS/api/cellular_network/main.cpp b/features/cellular/TESTS/api/cellular_network/main.cpp deleted file mode 100644 index b21c44c926..0000000000 --- a/features/cellular/TESTS/api/cellular_network/main.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2018, Arm Limited and affiliates. - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#if !defined(MBED_CONF_NSAPI_PRESENT) || !defined(MBED_CONF_APP_CELLULAR_SIM_PIN) -#error [NOT_SUPPORTED] A json configuration file is needed & SIM pin code is needed. Skipping this build. -#else - -#include "greentea-client/test_env.h" -#include "unity.h" -#include "utest.h" - -#include "mbed.h" - -#include "AT_CellularNetwork.h" -#include "CellularContext.h" -#include "CellularDevice.h" -#include "../../cellular_tests_common.h" - -#define NETWORK_TIMEOUT (180*1000) - -static CellularContext *ctx; -static CellularDevice *device; -static CellularNetwork *nw; - -static void init_network_interface() -{ - ctx = CellularContext::get_default_instance(); - TEST_ASSERT(ctx != NULL); - ctx->set_sim_pin(MBED_CONF_APP_CELLULAR_SIM_PIN); -#ifdef MBED_CONF_APP_APN - ctx->set_credentials(MBED_CONF_APP_APN); -#endif - TEST_ASSERT(ctx->register_to_network() == NSAPI_ERROR_OK); - - device = CellularDevice::get_default_instance(); - TEST_ASSERT(device != NULL); -} - -static bool get_network_registration(CellularNetwork::RegistrationType type, - CellularNetwork::RegistrationStatus &status, bool &is_registered) -{ - is_registered = false; - CellularNetwork::registration_params_t reg_params; - nsapi_error_t err = nw->get_registration_params(type, reg_params); - TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_UNSUPPORTED); - - status = reg_params._status; - switch (status) { - case CellularNetwork::RegisteredRoaming: - case CellularNetwork::RegisteredHomeNetwork: - is_registered = true; - break; - case CellularNetwork::RegisteredSMSOnlyRoaming: - case CellularNetwork::RegisteredSMSOnlyHome: - case CellularNetwork::RegisteredCSFBNotPreferredRoaming: - case CellularNetwork::RegisteredCSFBNotPreferredHome: - case CellularNetwork::AttachedEmergencyOnly: - case CellularNetwork::RegistrationDenied: - case CellularNetwork::NotRegistered: - case CellularNetwork::Unknown: - case CellularNetwork::SearchingNetwork: - default: - break; - } - return true; -} - -static bool is_registered() -{ - CellularNetwork::RegistrationStatus status; - bool is_registered = false; - - for (int type = 0; type < CellularNetwork::C_MAX; type++) { - if (get_network_registration((CellularNetwork::RegistrationType) type, status, is_registered)) { - if (is_registered) { - break; - } - } - } - - return is_registered; -} - -static void nw_callback(nsapi_event_t ev, intptr_t intptr) -{ -} - -static void test_network_registration() -{ - device->set_timeout(10 * 1000); - nw = device->open_network(); - TEST_ASSERT(nw != NULL); - - nw->attach(&nw_callback); - - bool success = false; - for (int type = 0; type < CellularNetwork::C_MAX; type++) { - if (!nw->set_registration_urc((CellularNetwork::RegistrationType)type, true)) { - success = true; - } - } - // each modem should support at least one registration type - TEST_ASSERT(success); - - int sanity_count = 0; - while (is_registered() == false) { - if (sanity_count == 0) { - TEST_ASSERT(nw->set_registration() == NSAPI_ERROR_OK); - } - sanity_count++; - wait(2); - TEST_ASSERT(sanity_count < 60); - } - - // device was registered right away, test set_registration call - if (sanity_count == 0) { - TEST_ASSERT(nw->set_registration() == NSAPI_ERROR_OK); - } - - CellularNetwork::NWRegisteringMode reg_mode = CellularNetwork::NWModeDeRegister; - TEST_ASSERT(nw->get_network_registering_mode(reg_mode) == NSAPI_ERROR_OK); - TEST_ASSERT(reg_mode == CellularNetwork::NWModeAutomatic); -} - -static void test_attach() -{ - wait(10); - TEST_ASSERT(nw->set_attach() == NSAPI_ERROR_OK); - - CellularNetwork::AttachStatus status; - TEST_ASSERT(nw->get_attach(status) == NSAPI_ERROR_OK); - TEST_ASSERT(status == CellularNetwork::Attached); -} - -static void test_other() -{ - TEST_ASSERT(nw->get_3gpp_error() == 0); - - nsapi_error_t err = nw->set_access_technology(CellularNetwork::RAT_GSM); - TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_UNSUPPORTED); - - // scanning of operators requires some delay before operation is allowed(seen with WISE_1570) - wait(5); - // scanning of operators might take a long time - device->set_timeout(240 * 1000); - CellularNetwork::operList_t operators; - int uplinkRate = -1; - TEST_ASSERT(nw->scan_plmn(operators, uplinkRate) == NSAPI_ERROR_OK); - device->set_timeout(10 * 1000); - - int rssi = -1; - int ber = -1; - err = nw->get_signal_quality(rssi, &ber); - TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR); - if (err == NSAPI_ERROR_DEVICE_ERROR) { - TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem - ((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem - (((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands - } - - CellularNetwork::registration_params_t reg_params; - reg_params._cell_id = -5; - TEST_ASSERT(nw->get_registration_params(reg_params) == NSAPI_ERROR_OK); - TEST_ASSERT(reg_params._cell_id != -5); - - int format = -1; - CellularNetwork::operator_t operator_params; - // all params are optional so can't test operator_params - err = nw->get_operator_params(format, operator_params); - TEST_ASSERT(err == NSAPI_ERROR_OK); - - nsapi_connection_status_t st = ctx->get_connection_status(); - TEST_ASSERT(st == NSAPI_STATUS_DISCONNECTED); - - // TELIT_HE910 and QUECTEL_BG96 just gives an error and no specific error number so we can't know is this real error or that modem/network does not support the command - CellularNetwork::CIoT_Supported_Opt supported_opt = CellularNetwork::CIOT_OPT_MAX; - CellularNetwork::CIoT_Preferred_UE_Opt preferred_opt = CellularNetwork::PREFERRED_UE_OPT_MAX; - err = nw->get_ciot_ue_optimization_config(supported_opt, preferred_opt); - TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR); - - err = nw->set_ciot_optimization_config(supported_opt, preferred_opt, NULL); - TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR); -} - -static void test_detach() -{ - // in PPP mode there is NO CARRIER waiting so flush it out - rtos::ThisThread::sleep_for(6 * 1000); - ((AT_CellularNetwork *)nw)->get_at_handler().flush(); - - nsapi_connection_status_t st = ctx->get_connection_status(); - TEST_ASSERT(st == NSAPI_STATUS_DISCONNECTED); - - TEST_ASSERT(nw->detach() == NSAPI_ERROR_OK); - // wait to process URC's, received after detach - rtos::ThisThread::sleep_for(500); - st = ctx->get_connection_status(); - TEST_ASSERT(st == NSAPI_STATUS_DISCONNECTED); -} - -using namespace utest::v1; - -static utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) -{ - greentea_case_failure_abort_handler(source, reason); - return STATUS_ABORT; -} - -static Case cases[] = { - Case("CellularNetwork init", init_network_interface, greentea_failure_handler), - Case("CellularNetwork test registering", test_network_registration, greentea_failure_handler), - Case("CellularNetwork test attach", test_attach, greentea_failure_handler), - Case("CellularNetwork test other functions", test_other, greentea_failure_handler), - Case("CellularNetwork test detach", test_detach, greentea_failure_handler) -}; - -static utest::v1::status_t test_setup(const size_t number_of_cases) -{ - GREENTEA_SETUP(10 * 60, "default_auto"); - return verbose_test_setup_handler(number_of_cases); -} - -static Specification specification(test_setup, cases); - -int main() -{ -#if MBED_CONF_MBED_TRACE_ENABLE - trace_open(); -#endif - int ret = Harness::run(specification); -#if MBED_CONF_MBED_TRACE_ENABLE - trace_close(); -#endif - return ret; -} -#endif // !defined(MBED_CONF_NSAPI_PRESENT) || !defined(MBED_CONF_APP_CELLULAR_SIM_PIN) diff --git a/features/cellular/TESTS/api/cellular_sms/main.cpp b/features/cellular/TESTS/api/cellular_sms/main.cpp deleted file mode 100644 index c1e7656c7a..0000000000 --- a/features/cellular/TESTS/api/cellular_sms/main.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 2018, Arm Limited and affiliates. - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#if !defined(MBED_CONF_NSAPI_PRESENT) || !defined(MBED_CONF_APP_CELLULAR_SIM_PIN) -#error [NOT_SUPPORTED] A json configuration file is needed & SIM pin code is needed. Skipping this build. -#else - -#if defined(TARGET_ADV_WISE_1570) || defined(TARGET_MTB_ADV_WISE_1570) -#error [NOT_SUPPORTED] target MTB_ADV_WISE_1570 does not have SMS functionality -#else - -#include "greentea-client/test_env.h" -#include "unity.h" -#include "utest.h" - -#include "mbed.h" - -#include "AT_CellularSMS.h" -#include "CellularContext.h" -#include "CellularDevice.h" -#include "../../cellular_tests_common.h" - -#define NETWORK_TIMEOUT (600*1000) -#define SIM_BUSY 314 - -static CellularContext *ctx; -static CellularDevice *device; -static CellularSMS *sms; -static char service_center_address[SMS_MAX_PHONE_NUMBER_SIZE]; -static int service_address_type; - -static void create_context() -{ - device = CellularDevice::get_default_instance(); - TEST_ASSERT(device != NULL); - device->set_timeout(9000); - ctx = CellularContext::get_default_instance(); - TEST_ASSERT(ctx != NULL); - ctx->set_sim_pin(MBED_CONF_APP_CELLULAR_SIM_PIN); -#ifdef MBED_CONF_APP_APN - ctx->set_credentials(MBED_CONF_APP_APN); -#endif -} - -static void store_service_center_address() -{ - // First we need to go SIM_PIN state to make sure that we can get service address and device ready to accept AT commands - create_context(); - TEST_ASSERT(ctx->set_sim_ready() == NSAPI_ERROR_OK); - - wait(5); // some modems needs more time access sim - - ATHandler *at_init = device->get_at_handler(); - at_init->lock(); - at_init->set_at_timeout(30 * 1000); - at_init->cmd_start("AT+CSCA?"); - at_init->cmd_stop(); - - TEST_ASSERT(at_init->get_last_error() == NSAPI_ERROR_OK); - - at_init->resp_start("+CSCA:"); - at_init->read_string(service_center_address, sizeof(service_center_address)); - service_address_type = at_init->read_int(); - at_init->resp_stop(); - TEST_ASSERT(at_init->get_last_error() == NSAPI_ERROR_OK); - - at_init->unlock(); - device->release_at_handler(at_init); -} - -static void init() -{ - // First store current service address - store_service_center_address(); - create_context(); - - TEST_ASSERT(ctx->register_to_network() == NSAPI_ERROR_OK); - sms = device->open_sms(); - TEST_ASSERT(sms != NULL); - wait(3); // some modems needs more time access sim -} - -static void test_sms_initialize_text_mode() -{ - nsapi_error_t err = sms->initialize(CellularSMS::CellularSMSMmodeText); - TEST_ASSERT(err == NSAPI_ERROR_OK || (err == NSAPI_ERROR_DEVICE_ERROR && - ((AT_CellularSMS *)sms)->get_device_error().errCode == SIM_BUSY)); - -} - -static void test_sms_initialize_pdu_mode() -{ - nsapi_error_t err = sms->initialize(CellularSMS::CellularSMSMmodePDU); - TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_UNSUPPORTED || (err == NSAPI_ERROR_DEVICE_ERROR && - ((AT_CellularSMS *)sms)->get_device_error().errCode == SIM_BUSY)); -} - -static void test_set_cscs() -{ - nsapi_error_t err = sms->set_cscs("IRA"); - TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_UNSUPPORTED || (err == NSAPI_ERROR_DEVICE_ERROR && - ((AT_CellularSMS *)sms)->get_device_error().errCode == SIM_BUSY)); - err = sms->set_cscs("UCS2"); - TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_UNSUPPORTED || (err == NSAPI_ERROR_DEVICE_ERROR && - ((AT_CellularSMS *)sms)->get_device_error().errCode == SIM_BUSY)); - err = sms->set_cscs("GSM"); - TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_UNSUPPORTED || (err == NSAPI_ERROR_DEVICE_ERROR && - ((AT_CellularSMS *)sms)->get_device_error().errCode == SIM_BUSY)); -} - -static void test_set_csca() -{ - nsapi_error_t err = sms->set_csca("55555", 129); - TEST_ASSERT(err == NSAPI_ERROR_OK || (err == NSAPI_ERROR_DEVICE_ERROR && - ((AT_CellularSMS *)sms)->get_device_error().errCode == SIM_BUSY)); - err = sms->set_csca("+35855555", 145); - TEST_ASSERT(err == NSAPI_ERROR_OK || (err == NSAPI_ERROR_DEVICE_ERROR && - ((AT_CellularSMS *)sms)->get_device_error().errCode == SIM_BUSY)); - err = sms->set_csca(service_center_address, service_address_type); - TEST_ASSERT(err == NSAPI_ERROR_OK || (err == NSAPI_ERROR_DEVICE_ERROR && - ((AT_CellularSMS *)sms)->get_device_error().errCode == SIM_BUSY)); -} - -static void test_set_cpms_me() -{ - nsapi_error_t err = sms->set_cpms("ME", "ME", "ME"); - TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_UNSUPPORTED || (err == NSAPI_ERROR_DEVICE_ERROR && - ((AT_CellularSMS *)sms)->get_device_error().errCode == SIM_BUSY)); -} - -#ifdef MBED_CONF_APP_CELLULAR_PHONE_NUMBER -static const char TEST_MESSAGE[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; -static int callbacks_received = 0; - -static void sms_callback() -{ - callbacks_received++; -} - -static void test_set_sms_callback() -{ - sms->set_sms_callback(sms_callback); -} - - -static void test_set_cpms_sm() -{ - TEST_ASSERT(sms->set_cpms("SM", "SM", "SM") == NSAPI_ERROR_OK); -} - -static void test_sms_send() -{ - const int msg_len = strlen(TEST_MESSAGE); - TEST_ASSERT(sms->send_sms(MBED_CONF_APP_CELLULAR_PHONE_NUMBER, TEST_MESSAGE, msg_len) == msg_len); -} - -static void test_get_sms() -{ - uint16_t buf_len = sizeof(TEST_MESSAGE); - char buf[buf_len]; - - char phone_num[SMS_MAX_PHONE_NUMBER_SIZE]; - - char time_stamp[SMS_MAX_TIME_STAMP_SIZE]; - - int buf_size = 0; - - wait(7); - - TEST_ASSERT(sms->get_sms(buf, buf_len, phone_num, SMS_MAX_PHONE_NUMBER_SIZE, time_stamp, SMS_MAX_TIME_STAMP_SIZE, &buf_size) == buf_len - 1); - TEST_ASSERT(strcmp(phone_num, MBED_CONF_APP_CELLULAR_PHONE_NUMBER) == 0); - TEST_ASSERT(strcmp(buf, TEST_MESSAGE) == 0); - TEST_ASSERT(buf_size == 0); - TEST_ASSERT(callbacks_received > 0); - callbacks_received = 0; - -} - -static void test_delete_all_messages() -{ - //send a message so that there is something to delete - test_sms_send(); - wait(7); - TEST_ASSERT(sms->delete_all_messages() == NSAPI_ERROR_OK); - callbacks_received = 0; -} - -static void test_set_extra_sim_wait_time_1000() -{ - sms->set_extra_sim_wait_time(1000); -} - -#endif - -using namespace utest::v1; - -static utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) -{ - greentea_case_failure_abort_handler(source, reason); - return STATUS_ABORT; -} - -static Case cases[] = { - Case("CellularSMS init", init, greentea_failure_handler), - Case("CellularSMS test ME for storage", test_set_cpms_me, greentea_failure_handler), - Case("CellularSMS test initialize to PDU mode", test_sms_initialize_pdu_mode, greentea_failure_handler), - Case("CellularSMS test character sets", test_set_cscs, greentea_failure_handler), - Case("CellularSMS test service center address", test_set_csca, greentea_failure_handler) -#ifdef MBED_CONF_APP_CELLULAR_PHONE_NUMBER - , - Case("CellularSMS test delete all messages", test_delete_all_messages, greentea_failure_handler), - Case("CellularSMS test sms callback", test_set_sms_callback, greentea_failure_handler), - Case("CellularSMS test sms send", test_sms_send, greentea_failure_handler), - Case("CellularSMS test get sms", test_get_sms, greentea_failure_handler), - Case("CellularSMS test set sim wait time 1s", test_set_extra_sim_wait_time_1000, greentea_failure_handler), - Case("CellularSMS test SM for storage", test_set_cpms_sm, greentea_failure_handler), - Case("CellularSMS test initialize to text mode", test_sms_initialize_text_mode, greentea_failure_handler), - Case("CellularSMS test delete all messages", test_delete_all_messages, greentea_failure_handler), - Case("CellularSMS test sms send", test_sms_send, greentea_failure_handler), - Case("CellularSMS test get sms", test_get_sms, greentea_failure_handler), - Case("CellularSMS test delete all messages", test_delete_all_messages, greentea_failure_handler) -#endif -}; - -static utest::v1::status_t test_setup(const size_t number_of_cases) -{ - GREENTEA_SETUP(600, "default_auto"); - return verbose_test_setup_handler(number_of_cases); -} - -static Specification specification(test_setup, cases); - -int main() -{ -#if MBED_CONF_MBED_TRACE_ENABLE - trace_open(); -#endif - int ret = Harness::run(specification); -#if MBED_CONF_MBED_TRACE_ENABLE - trace_close(); -#endif - return ret; -} - -#endif //defined(TARGET_ADV_WISE_1570) || defined(TARGET_MTB_ADV_WISE_1570) -#endif // !defined(MBED_CONF_NSAPI_PRESENT) || !defined(MBED_CONF_APP_CELLULAR_SIM_PIN) diff --git a/features/cellular/TESTS/cellular_tests_common.h b/features/cellular/TESTS/cellular_tests_common.h deleted file mode 100644 index 0303552412..0000000000 --- a/features/cellular/TESTS/cellular_tests_common.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2018, Arm Limited and affiliates. - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef CELLULAR_TESTS_COMMON_H_ -#define CELLULAR_TESTS_COMMON_H_ - -#include "CellularLog.h" - -#if MBED_CONF_MBED_TRACE_ENABLE - -static rtos::Mutex trace_mutex; - -void trace_wait() -{ - trace_mutex.lock(); -} - -void trace_release() -{ - trace_mutex.unlock(); -} - -static char time_st[sizeof("[12345678]") + 1]; - -static char *trace_time(size_t ss) -{ - snprintf(time_st, sizeof("[12345678]"), "[%08llu]", rtos::Kernel::get_ms_count()); - return time_st; -} - -static void trace_open() -{ - mbed_trace_init(); - mbed_trace_prefix_function_set(&trace_time); - mbed_trace_mutex_wait_function_set(trace_wait); - mbed_trace_mutex_release_function_set(trace_release); - - mbed_cellular_trace::mutex_wait_function_set(trace_wait); - mbed_cellular_trace::mutex_release_function_set(trace_release); -} - -static void trace_close() -{ - mbed_cellular_trace::mutex_wait_function_set(NULL); - mbed_cellular_trace::mutex_release_function_set(NULL); - - mbed_trace_free(); -} - -#endif // MBED_CONF_MBED_TRACE_ENABLE - - -#endif /* CELLULAR_TESTS_COMMON_H_ */ diff --git a/features/cellular/TESTS/socket/udp/main.cpp b/features/cellular/TESTS/socket/udp/main.cpp deleted file mode 100644 index 3efd3814cd..0000000000 --- a/features/cellular/TESTS/socket/udp/main.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2018, Arm Limited and affiliates. - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#if !defined(MBED_CONF_NSAPI_PRESENT) || !defined(MBED_CONF_APP_CELLULAR_SIM_PIN) -#error [NOT_SUPPORTED] A json configuration file is needed & SIM pin code is needed. Skipping this build. -#else - -#include "CellularUtil.h" // for CELLULAR_ helper macros - -#include "greentea-client/test_env.h" -#include "unity.h" -#include "utest.h" - -#include "mbed.h" - -#include "CellularContext.h" - -#if MBED_CONF_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP -#include "APN_db.h" -#endif //MBED_CONF_CELLULAR_USE_APN_LOOKUP || MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP - -#include "../../cellular_tests_common.h" - -#define NETWORK_TIMEOUT (180*1000) -#define SOCKET_TIMEOUT (30*1000) - -#define ECHO_SERVER_NAME "echo.mbedcloudtesting.com" -#define ECHO_SERVER_UDP_PORT 8877 - -static CellularContext *ctx; -static SocketAddress echo_server_addr; -static rtos::EventFlags eventFlags; - -class EchoSocket : public UDPSocket { -public: - EchoSocket(int size) : UDPSocket(), _data(0), _size(size), _async_flag(0), _tx_pending(false), _rx_pending(false) - { - } - virtual ~EchoSocket() - { - delete _data; - } - void set_async(int async) - { - _async_flag = async; - if (_async_flag) { - set_blocking(false); - sigio(callback(this, &EchoSocket::async_callback)); - } - } - - void test_sendto(const char *const hostname = NULL) - { - if (!_data) { - _data = new uint8_t[_size]; - for (int i = 0; i < _size; i++) { - _data[i] = (uint8_t)rand(); - } - } - nsapi_size_or_error_t ret; - if (hostname) { - ret = sendto(hostname, ECHO_SERVER_UDP_PORT, _data, _size); - } else { - ret = sendto(echo_server_addr, _data, _size); - } - if (ret == _size) { // send successful - _tx_pending = false; - } else { - TEST_ASSERT(_async_flag && ret == NSAPI_ERROR_WOULD_BLOCK); - _tx_pending = true; - } - } - - void test_recvfrom() - { - uint8_t *buf = new uint8_t[_size]; - memset(buf, 0, _size); - SocketAddress recv_address; - nsapi_size_or_error_t ret = recvfrom(&recv_address, buf, _size); - if (ret == _size) { // recv successful - _rx_pending = false; - TEST_ASSERT(recv_address == echo_server_addr); - TEST_ASSERT(memcmp(_data, buf, _size) == 0); - delete _data; - _data = NULL; - _rx_pending = false; - } else { - TEST_ASSERT(_async_flag && ret == NSAPI_ERROR_WOULD_BLOCK); - _rx_pending = true; - } - delete buf; - } - - bool async_process() - { - if (_tx_pending) { - test_sendto(); - } - if (_rx_pending) { - test_recvfrom(); - } - return _tx_pending | _rx_pending; - } - -private: - void async_callback() - { - eventFlags.set(_async_flag); - } - uint8_t *_data; - int _size; - uint32_t _async_flag; // 0 for blocking socket, signal bit for async - bool _tx_pending; - bool _rx_pending; -}; - -static void udp_network_stack() -{ - ctx = CellularContext::get_default_instance(); - TEST_ASSERT(ctx != NULL); - ctx->set_sim_pin(MBED_CONF_APP_CELLULAR_SIM_PIN); -#ifdef MBED_CONF_APP_APN - ctx->set_credentials(MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD); -#endif - TEST_ASSERT(ctx->connect() == NSAPI_ERROR_OK); -} - -static void udp_gethostbyname() -{ - TEST_ASSERT(ctx->gethostbyname(ECHO_SERVER_NAME, &echo_server_addr) == 0); - tr_info("Echo server IP: %s", echo_server_addr.get_ip_address()); - echo_server_addr.set_port(7); -} - -static void udp_socket_send_receive() -{ - EchoSocket echo_socket(4); - TEST_ASSERT(echo_socket.open(ctx) == NSAPI_ERROR_OK); - echo_socket.set_blocking(true); - echo_socket.set_timeout(SOCKET_TIMEOUT); - echo_socket.test_sendto(); - echo_socket.test_recvfrom(); - TEST_ASSERT(echo_socket.close() == NSAPI_ERROR_OK); -} - -static void udp_socket_send_receive_async() -{ - int async_flag = 1; - TEST_ASSERT(!(eventFlags.clear(async_flag) & osFlagsError)); - - EchoSocket echo_socket(4); - TEST_ASSERT(echo_socket.open(ctx) == NSAPI_ERROR_OK); - echo_socket.set_async(async_flag); - echo_socket.test_sendto(); - echo_socket.test_recvfrom(); - - while (true) { - TEST_ASSERT((eventFlags.wait_any(async_flag, SOCKET_TIMEOUT) & (osFlagsError)) != osFlagsError); - if (!echo_socket.async_process()) { - break; - } - } - TEST_ASSERT(echo_socket.close() == NSAPI_ERROR_OK); -} - -using namespace utest::v1; - -static utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) -{ -#if MBED_CONF_MBED_TRACE_ENABLE - trace_close(); -#endif - greentea_case_failure_abort_handler(source, reason); - return STATUS_ABORT; -} - -static Case cases[] = { - Case("UDP network stack", udp_network_stack, greentea_failure_handler), - Case("UDP gethostbyname", udp_gethostbyname, greentea_failure_handler), - Case("UDP socket send/receive", udp_socket_send_receive, greentea_failure_handler), - Case("UDP socket send/receive async", udp_socket_send_receive_async, greentea_failure_handler), -}; - -static utest::v1::status_t test_setup(const size_t number_of_cases) -{ - GREENTEA_SETUP(10 * 60, "default_auto"); // network registration may take up to 180 seconds, DNS query a couple of minutes, etc. - return verbose_test_setup_handler(number_of_cases); -} - -static Specification specification(test_setup, cases); - -int main() -{ -#if MBED_CONF_MBED_TRACE_ENABLE - trace_open(); -#endif - int ret = Harness::run(specification); -#if MBED_CONF_MBED_TRACE_ENABLE - trace_close(); -#endif - return ret; -} -#endif // !defined(MBED_CONF_NSAPI_PRESENT) || !defined(MBED_CONF_APP_CELLULAR_SIM_PIN) diff --git a/features/cellular/TESTS/socket/udp/template_mbed_app.json.txt b/features/cellular/TESTS/socket/udp/template_mbed_app.json.txt deleted file mode 100644 index 983fd68dd9..0000000000 --- a/features/cellular/TESTS/socket/udp/template_mbed_app.json.txt +++ /dev/null @@ -1,47 +0,0 @@ -{ - "config": { - "cellular_sim_pin": { - "help": "PIN code", - "value": "\"1234\"" - }, - "cellular_plmn": { - "help": "plmn to select manual registration", - "value": 0 - }, - "apn": { - "help": "The APN string to use for this SIM/network, set to 0 if none", - "value": 0 - }, - "username": { - "help": "The user name string to use for this APN, set to zero if none", - "value": 0 - }, - "password": { - "help": "The password string to use for this APN, set to 0 if none", - "value": 0 - }, - "trace-level": { - "help": "Note that excessive trace prints may mess up with Greentea parsing", - "macro_name": "MBED_TRACE_MAX_LEVEL", - "value": "TRACE_LEVEL_ERROR" - } - }, - "target_overrides": { - "*": { - "nsapi.dns-response-wait-time": 30000, - "ppp-cell-iface.apn-lookup": false, - "cellular.use-apn-lookup": false, - "mbed-trace.enable": false, - "lwip.ipv4-enabled": true, - "lwip.ipv6-enabled": true, - "lwip.tcp-enabled": false, - "lwip.ppp-enabled": true, - "lwip.ethernet-enabled": false, - "platform.stdio-convert-newlines": true, - "platform.default-serial-baud-rate": 115200, - "drivers.uart-serial-txbuf-size": 512, - "drivers.uart-serial-rxbuf-size": 1024, - "cellular.debug-at": false - } - } -} diff --git a/features/cellular/junit_xsl.xslt b/features/cellular/junit_xsl.xslt deleted file mode 100644 index 7376b27f26..0000000000 --- a/features/cellular/junit_xsl.xslt +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - -

- Unittest report -

- -

- - Total tests run - , failures: - - - - - -

-
- - -

- -

- - - - - - - - - - - -
Tests runTests failedOther errors
-
- - - - - - - - -
Tests namePASS/FAILFailing caseReason
-
- - - - - - - - - - - PASS - - - - - - - FAIL - - - - - - - - - - - - - - - - FAIL - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/features/cellular/xsl_script.sh b/features/cellular/xsl_script.sh deleted file mode 100755 index d5320b42b8..0000000000 --- a/features/cellular/xsl_script.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2015 ARM Limited. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# Licensed under the Apache License, Version 2.0 (the License); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# * http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an AS IS BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -echo -echo "Creating report" -echo - -echo ' - -' >> lcov/index.xml - -for f in lcov/results/*.xml -do -name=${f##*/} -echo ''>> lcov/index.xml -done - -echo '' >> lcov/index.xml - -echo -echo "Report created to lcov/index.xml (outputs html)" -echo \ No newline at end of file