Skip to content

Commit

Permalink
Merge pull request #10469 from ARMmbed/release-candidate
Browse files Browse the repository at this point in the history
Release candidate for mbed-os-5.12.2
  • Loading branch information
adbridge authored Apr 26, 2019
2 parents 0063e5d + a3e7416 commit cfa7938
Show file tree
Hide file tree
Showing 419 changed files with 159,650 additions and 133,596 deletions.
337 changes: 165 additions & 172 deletions .travis.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ The Python modules used by Mbed tools are used under the following licenses:
- [pycryptodome](https://pypi.org/project/pycryptodome) - BSD-2-Clause
- [pyusb](https://pypi.org/project/pyusb/) - Apache-2.0
- [cmsis-pack-manager](https://pypi.org/project/cmsis-pack-manager) - Apache-2.0
- [hidapi](https://pypi.org/project/hidapi/) - BSD-style
566 changes: 566 additions & 0 deletions TESTS/host_tests/usb_device_hid.py

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion TESTS/mbed_drivers/lp_timeout/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ Case cases[] = {
Case("1 s delay during deepsleep (attach_us)", test_deepsleep<AttachUSTester<LowPowerTimeout>, 1000000, LONG_DELTA_US>,
greentea_failure_handler),
#endif

#if !defined(__ARM_FM) //FastModels not support time drifting test
Case("Timing drift (attach)", test_drift<AttachTester<LowPowerTimeout> >),
Case("Timing drift (attach_us)", test_drift<AttachUSTester<LowPowerTimeout> >),
#endif
};

utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
Expand Down
3 changes: 0 additions & 3 deletions TESTS/netsocket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -859,9 +859,6 @@ Within each loop, one `recvfrom()` may return the received packet size
When `NSAPI_ERROR_WOULD_BLOCK` is received, check that time consumed is
more that 100 milliseconds but less than 200 milliseconds.

After repeating for 10 times, at least 5 packets must have been
received.


### UDPSOCKET_SENDTO_TIMEOUT

Expand Down
15 changes: 7 additions & 8 deletions TESTS/netsocket/tcp/tcpsocket_echotest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ void TCPSOCKET_ECHOTEST()

int recvd;
int sent;
int x = 0;
for (int pkt_s = pkt_sizes[x]; x < PKTS; pkt_s = pkt_sizes[x++]) {
for (int s_idx = 0; s_idx < sizeof(pkt_sizes) / sizeof(*pkt_sizes); s_idx++) {
int pkt_s = pkt_sizes[s_idx];
fill_tx_buffer_ascii(tcp_global::tx_buffer, BUFF_SIZE);
sent = sock.send(tcp_global::tx_buffer, pkt_s);
if (sent < 0) {
printf("[Round#%02d] network error %d\n", x, sent);
printf("[Round#%02d] network error %d\n", s_idx, sent);
TEST_FAIL();
break;
} else if (sent != pkt_s) {
printf("[%02d] sock.send return size %d does not match the expectation %d\n", x, sent, pkt_s);
printf("[%02d] sock.send return size %d does not match the expectation %d\n", s_idx, sent, pkt_s);
TEST_FAIL();
break;
}
Expand All @@ -85,7 +85,7 @@ void TCPSOCKET_ECHOTEST()
while (bytes2recv) {
recvd = sock.recv(&(tcp_global::rx_buffer[sent - bytes2recv]), bytes2recv);
if (recvd < 0) {
printf("[Round#%02d] network error %d\n", x, recvd);
printf("[Round#%02d] network error %d\n", s_idx, recvd);
TEST_FAIL();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
return;
Expand Down Expand Up @@ -143,7 +143,6 @@ void TCPSOCKET_ECHOTEST_NONBLOCK()

int bytes2send;
int sent;
int s_idx = 0;
receive_error = false;
unsigned char *stack_mem = (unsigned char *)malloc(tcp_global::TCP_OS_STACK_SIZE);
TEST_ASSERT_NOT_NULL(stack_mem);
Expand All @@ -154,8 +153,8 @@ void TCPSOCKET_ECHOTEST_NONBLOCK()

TEST_ASSERT_EQUAL(osOK, receiver_thread->start(callback(&queue, &EventQueue::dispatch_forever)));

for (int pkt_s = pkt_sizes[s_idx]; s_idx < PKTS; ++s_idx) {
pkt_s = pkt_sizes[s_idx];
for (int s_idx = 0; s_idx < sizeof(pkt_sizes) / sizeof(*pkt_sizes); ++s_idx) {
int pkt_s = pkt_sizes[s_idx];
bytes2recv = pkt_s;
bytes2recv_total = pkt_s;

Expand Down
16 changes: 8 additions & 8 deletions TESTS/netsocket/tls/tlssocket_echotest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ void TLSSOCKET_ECHOTEST()

int recvd;
int sent;
int x = 0;
for (int pkt_s = pkt_sizes[x]; x < PKTS; pkt_s = pkt_sizes[x++]) {
for (int s_idx = 0; s_idx < sizeof(pkt_sizes) / sizeof(*pkt_sizes); s_idx++) {
int pkt_s = pkt_sizes[s_idx];
fill_tx_buffer_ascii(tls_global::tx_buffer, BUFF_SIZE);

sent = sock->send(tls_global::tx_buffer, pkt_s);
if (sent < 0) {
printf("[Round#%02d] network error %d\n", x, sent);
printf("[Round#%02d] network error %d\n", s_idx, sent);
TEST_FAIL();
break;
} else if (sent != pkt_s) {
printf("[%02d] sock.send return size %d does not match the expectation %d\n", x, sent, pkt_s);
printf("[%02d] sock.send return size %d does not match the expectation %d\n", s_idx, sent, pkt_s);
TEST_FAIL();
break;
}
Expand All @@ -89,7 +89,7 @@ void TLSSOCKET_ECHOTEST()
while (bytes2recv) {
recvd = sock->recv(&(tls_global::rx_buffer[sent - bytes2recv]), bytes2recv);
if (recvd < 0) {
printf("[Round#%02d] network error %d\n", x, recvd);
printf("[Round#%02d] network error %d\n", s_idx, recvd);
TEST_FAIL();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->close());
return;
Expand Down Expand Up @@ -146,7 +146,7 @@ void TLSSOCKET_ECHOTEST_NONBLOCK()

int bytes2send;
int sent;
int s_idx = 0;
;
receive_error = false;
unsigned char *stack_mem = (unsigned char *)malloc(tls_global::TLS_OS_STACK_SIZE);
TEST_ASSERT_NOT_NULL(stack_mem);
Expand All @@ -158,8 +158,8 @@ void TLSSOCKET_ECHOTEST_NONBLOCK()
event_queue = &queue;
TEST_ASSERT_EQUAL(osOK, receiver_thread->start(callback(&queue, &EventQueue::dispatch_forever)));

for (int pkt_s = pkt_sizes[s_idx]; s_idx < PKTS; ++s_idx) {
pkt_s = pkt_sizes[s_idx];
for (int s_idx = 0; s_idx < sizeof(pkt_sizes) / sizeof(*pkt_sizes); ++s_idx) {
int pkt_s = pkt_sizes[s_idx];
bytes2recv = pkt_s;
bytes2recv_total = pkt_s;

Expand Down
2 changes: 1 addition & 1 deletion TESTS/netsocket/tls/tlssocket_recv_timeout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using namespace utest::v1;

namespace {
static const int SIGNAL_SIGIO = 0x1;
static const int SIGIO_TIMEOUT = 20000; //[ms]
static const int SIGIO_TIMEOUT = 50000; //[ms]
}

static void _sigio_handler(osThreadId id)
Expand Down
10 changes: 4 additions & 6 deletions TESTS/netsocket/udp/udpsocket_echotest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@ void UDPSOCKET_ECHOTEST()

int recvd;
int sent;
int s_idx = 0;
int packets_sent = 0;
int packets_recv = 0;
for (int pkt_s = pkt_sizes[s_idx]; s_idx < PKTS; pkt_s = ++s_idx) {
pkt_s = pkt_sizes[s_idx];
for (int s_idx = 0; s_idx < sizeof(pkt_sizes) / sizeof(*pkt_sizes); ++s_idx) {
int pkt_s = pkt_sizes[s_idx];

fill_tx_buffer_ascii(tx_buffer, BUFF_SIZE);

Expand Down Expand Up @@ -147,15 +146,14 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
sock.sigio(callback(_sigio_handler));

int sent;
int s_idx = 0;
int packets_sent = 0;
int packets_recv = 0;
Thread *thread;
unsigned char *stack_mem = (unsigned char *)malloc(OS_STACK_SIZE);
TEST_ASSERT_NOT_NULL(stack_mem);

for (int pkt_s = pkt_sizes[s_idx]; s_idx < PKTS; ++s_idx) {
pkt_s = pkt_sizes[s_idx];
for (int s_idx = 0; s_idx < sizeof(pkt_sizes) / sizeof(*pkt_sizes); ++s_idx) {
int pkt_s = pkt_sizes[s_idx];

thread = new Thread(osPriorityNormal,
OS_STACK_SIZE,
Expand Down
5 changes: 3 additions & 2 deletions TESTS/netsocket/udp/udpsocket_recv_timeout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ using namespace utest::v1;
namespace {
static const int SIGNAL_SIGIO = 0x1;
static const int SIGIO_TIMEOUT = 5000; //[ms]
static const int PKT_NUM = 2;
}

static void _sigio_handler(osThreadId id)
Expand All @@ -52,7 +53,7 @@ void UDPSOCKET_RECV_TIMEOUT()
Timer timer;
SocketAddress temp_addr;
int pkt_success = 0;
for (int i = 0; i < 10; i++) {
for (int i = 0; i < PKT_NUM; i++) {
TEST_ASSERT_EQUAL(DATA_LEN, sock.sendto(udp_addr, buff, DATA_LEN));
timer.reset();
timer.start();
Expand All @@ -75,6 +76,6 @@ void UDPSOCKET_RECV_TIMEOUT()
pkt_success++;
}

TEST_ASSERT(pkt_success >= 5);
printf("MBED: %d out of %d packets were received.\n", pkt_success, PKT_NUM);
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
}
4 changes: 3 additions & 1 deletion TESTS/network/wifi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ git checkout master
cd ..
```

Prepare an `mbed_app.json` configuration file with all the required definitions provided. See [template_mbed_app.txt](template_mbed_app.txt) file for the full list of necessary definitions.

Now build test binaries:

```.sh
mbed test --compile -t <toolchain> -m <target> -n mbed-os-tests-network-wifi
mbed test --compile -t <toolchain> -m <target> --app-config TESTS/network/wifi/template_mbed_app.txt -n mbed-os-tests-network-wifi
```

Running tests
Expand Down
2 changes: 1 addition & 1 deletion TESTS/psa/spm_client/COMPONENT_NSPE/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include "psa_manifest/sid.h"

#if defined(TARGET_TFM)
#include "psa/service.h"
#define MBED_CONF_SPM_IPC_MAX_NUM_OF_CHANNELS TFM_CONN_HANDLE_MAX_NUM
#define PSA_MAX_IOVEC 4
#endif

using namespace utest::v1;
Expand Down
2 changes: 1 addition & 1 deletion TESTS/psa/spm_server/COMPONENT_NSPE/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "psa_manifest/sid.h"

#if defined(TARGET_TFM)
#include "psa/service.h"
#define PSA_MAX_IOVEC 4
#endif

using namespace utest::v1;
Expand Down
2 changes: 1 addition & 1 deletion TESTS/psa/spm_smoke/COMPONENT_NSPE/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "psa_manifest/sid.h"

#if defined(TARGET_TFM)
#include "psa/service.h"
#define PSA_MAX_IOVEC 4
#endif

using namespace utest::v1;
Expand Down
23 changes: 23 additions & 0 deletions TESTS/usb_device/hid/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Testing the USB HID device with a Linux host

Before running `tests-usb_device-hid` test suite on a Linux machine, please
make sure to install the `hidapi` Python module first, otherwise some test
cases will be skipped. Due to external dependencies for Linux, this module
is not installed during the initial setup, to keep the process as simple
as possible.

For Debian-based Linux distros, the dependencies can be installed as follows
(based on module's [README][1]):

```bash
apt-get install python-dev libusb-1.0-0-dev libudev-dev
pip install --upgrade setuptools
```
To install the `hidapi` module itself, please use the attached
`TESTS/usb_device/hid/requirements.txt` file:
```bash
pip install -r requirements.txt
```

[1]: https://github.com/trezor/cython-hidapi/blob/master/README.rst#install

Loading

0 comments on commit cfa7938

Please sign in to comment.