mirror of https://github.com/ARMmbed/mbed-os.git
Cellular Greentea tests fixed
parent
ac9b882049
commit
d7cabe2183
|
@ -12,6 +12,10 @@ This is the Github repo for Mbed cellular connectivity:
|
|||
common Common and utility sources
|
||||
targets Vendor specific cellular module adaptations
|
||||
|
||||
TESTS Cellular Greentea test
|
||||
|
||||
UNITTESTS Cellular unit test
|
||||
|
||||
## Known limitations
|
||||
|
||||
**Please note that this is a first release of Cellular framework and is subject to further development in future.**
|
||||
|
@ -24,7 +28,9 @@ You can find currently supported cellular modules in the `framework/targets/` fo
|
|||
|
||||
## Cellular configuration
|
||||
|
||||
You can change cellular defaults in the `mbed_app.json` configuration file:
|
||||
You can change cellular defaults in the `mbed_lib.json` configuration file.
|
||||
|
||||
You can also override cellular defaults in the `mbed_app.json` configuration file:
|
||||
|
||||
"config": {
|
||||
"cellular_plmn": {
|
||||
|
@ -62,6 +68,14 @@ 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, e.g.:
|
||||
|
||||
mbed test -n features-cellular-tests-* --app-config features\cellular\TESTS\socket\udp\template_mbed_app.json -vv
|
||||
|
||||
Note that Greentea tests use SIM PIN so you need to change that or your SIM card may get locked.
|
||||
|
||||
## Unit tests
|
||||
|
||||
The `UNITTESTS` folder contains unit tests for cellular specific classes. Unit tests are based on the stubbing method.
|
||||
|
|
|
@ -213,7 +213,7 @@ static Case cases[] = {
|
|||
|
||||
static utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||
{
|
||||
GREENTEA_SETUP(180, "default_auto");
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
{
|
||||
"config": {
|
||||
"network-interface":{
|
||||
"help": "Options are ETHERNET,CELLULAR",
|
||||
"value": "CELLULAR"
|
||||
},
|
||||
"cellular_sim_pin": {
|
||||
"help": "PIN code",
|
||||
"value": "\"1234\""
|
||||
|
|
|
@ -1001,9 +1001,7 @@ void ATHandler::cmd_start(const char* cmd)
|
|||
}
|
||||
}
|
||||
|
||||
tr_debug("AT> %s", cmd);
|
||||
|
||||
|
||||
at_debug("AT cmd %s (err %d)\n", cmd, _last_err);
|
||||
|
||||
if (_last_err != NSAPI_ERROR_OK) {
|
||||
return;
|
||||
|
@ -1016,7 +1014,7 @@ void ATHandler::cmd_start(const char* cmd)
|
|||
|
||||
void ATHandler::write_int(int32_t param)
|
||||
{
|
||||
tr_debug("write_int: %d", param);
|
||||
at_debug("AT int %d\n", param);
|
||||
// do common checks before sending subparameter
|
||||
if (check_cmd_send() == false) {
|
||||
return;
|
||||
|
@ -1033,7 +1031,7 @@ void ATHandler::write_int(int32_t param)
|
|||
|
||||
void ATHandler::write_string(const char* param, bool useQuotations)
|
||||
{
|
||||
tr_debug("write_string: %s, %d", param, useQuotations);
|
||||
at_debug("AT str %s (with quotes %d)\n", param, useQuotations);
|
||||
// do common checks before sending subparameter
|
||||
if (check_cmd_send() == false) {
|
||||
return;
|
||||
|
@ -1054,6 +1052,7 @@ void ATHandler::write_string(const char* param, bool useQuotations)
|
|||
|
||||
void ATHandler::cmd_stop()
|
||||
{
|
||||
at_debug("AT stop %s (err %d)\n", _output_delimiter, _last_err);
|
||||
if (_last_err != NSAPI_ERROR_OK) {
|
||||
return;
|
||||
}
|
||||
|
@ -1063,28 +1062,33 @@ void ATHandler::cmd_stop()
|
|||
|
||||
size_t ATHandler::write_bytes(const uint8_t *data, size_t len)
|
||||
{
|
||||
at_debug("AT write bytes %d (err %d)\n", len, _last_err);
|
||||
|
||||
if (_last_err != NSAPI_ERROR_OK) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t write_len = write(data, len);
|
||||
return write_len < 0 ? 0 : (size_t)write_len;
|
||||
return write(data, len);
|
||||
}
|
||||
|
||||
ssize_t ATHandler::write(const void *data, size_t len)
|
||||
size_t ATHandler::write(const void *data, size_t len)
|
||||
{
|
||||
pollfh fhs;
|
||||
fhs.fh = _fileHandle;
|
||||
fhs.events = POLLOUT;
|
||||
ssize_t write_len = -1;
|
||||
|
||||
int count = poll(&fhs, 1, _at_timeout);
|
||||
if (count > 0 && (fhs.revents & POLLOUT)) {
|
||||
write_len = _fileHandle->write(data, len);
|
||||
}
|
||||
|
||||
if (write_len < 0 || (size_t)write_len != len) {
|
||||
set_error(NSAPI_ERROR_DEVICE_ERROR);
|
||||
size_t write_len = 0;
|
||||
for (; write_len < len; ) {
|
||||
int count = poll(&fhs, 1, _at_timeout);
|
||||
if (count <= 0 || !(fhs.revents & POLLOUT)) {
|
||||
set_error(NSAPI_ERROR_DEVICE_ERROR);
|
||||
return 0;
|
||||
}
|
||||
ssize_t ret = _fileHandle->write((uint8_t*)data + write_len, len - write_len);
|
||||
if (ret < 0) {
|
||||
set_error(NSAPI_ERROR_DEVICE_ERROR);
|
||||
return 0;
|
||||
}
|
||||
write_len += (size_t)ret;
|
||||
}
|
||||
|
||||
return write_len;
|
||||
|
|
|
@ -458,7 +458,7 @@ private:
|
|||
void set_3gpp_error(int err, DeviceErrorType error_type);
|
||||
|
||||
bool check_cmd_send();
|
||||
ssize_t write(const void *data, size_t len);
|
||||
size_t write(const void *data, size_t len);
|
||||
|
||||
/** Copy content of one char buffer to another buffer and sets NULL terminator
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue