Skip to content

Commit a8d1d26

Browse files
authored
Merge pull request #9508 from ARMmbed/release-candidate
Release candidate for mbed-os-5.11.3
2 parents a8f0c33 + 36bb984 commit a8d1d26

File tree

212 files changed

+15589
-624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+15589
-624
lines changed

.github/issue_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<!--
2020
Required
2121
Add detailed description of what you are reporting.
22-
Good example: https://os.mbed.com/docs/latest/reference/workflow.html
22+
Good example: https://os.mbed.com/docs/mbed-os/latest/contributing/workflow.html
2323
Things to consider sharing:
2424
- What target does this relate to?
2525
- What toolchain (name + version) are you using?

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!--
44
Required
55
Add here detailed changes summary, testing results, dependencies
6-
Good example: https://os.mbed.com/docs/latest/reference/workflow.html (Pull request template)
6+
Good example: https://os.mbed.com/docs/mbed-os/latest/contributing/workflow.html (Pull request template)
77
-->
88

99

.travis.yml

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ matrix:
8585
- doxygen doxyfile_options 2>&1
8686
# Once Mbed OS has been fixed, enable the full test by replacing the top line with this:
8787
# - ( ! doxygen doxyfile_options 2>&1 | grep . )
88-
8988
# Assert that all binary libraries are named correctly
9089
# The strange command below asserts that there are exactly 0 libraries
9190
# that do not start with lib
@@ -106,12 +105,20 @@ matrix:
106105
install:
107106
# Install dependencies
108107
- sudo apt-get install gcc-arm-embedded
109-
- pip install -r requirements.txt
110-
- pip install pytest pylint hypothesis==3.88.3 mock coverage coveralls
111-
# Print versions we use
112-
113108
- arm-none-eabi-gcc --version
109+
# Add additional dependencies specific for testing
114110
- python --version
111+
- |-
112+
tr -d ' ' >> requirements.txt <<< "
113+
mock==2.0.0
114+
pytest==3.3.0
115+
pylint>=1.9,<2
116+
hypothesis>=3,<4
117+
coverage>=4.5,<5
118+
coveralls>=1.5,<2
119+
"
120+
# ... and install.
121+
- pip install -r requirements.txt
115122
- pip list --verbose
116123
script:
117124
# Run local testing on tools
@@ -122,7 +129,27 @@ matrix:
122129
after_success:
123130
# Coverage for tools
124131
- coveralls
125-
# Report success since we have overridden default behaviour
132+
# Report success since we have overridden default behavior
133+
- bash -c "$STATUS" success "Local $NAME testing has passed"
134+
135+
- env:
136+
- NAME=doxy-spellcheck
137+
138+
install:
139+
- sudo apt-get install aspell
140+
141+
script:
142+
# Run local testing on header file doxy
143+
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh drivers
144+
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh platform
145+
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh events
146+
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh rtos
147+
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh features/netsocket
148+
149+
after_success:
150+
# Coverage for tools
151+
- coveralls
152+
# Report success since we have overridden default behavior
126153
- bash -c "$STATUS" success "Local $NAME testing has passed"
127154

128155
# - <<: *tools-pytest
@@ -275,9 +302,18 @@ matrix:
275302
- env:
276303
- NAME=licence_check
277304
script:
278-
- echo 'Checking that there is no GPL licence text in code'
279-
- ! git grep -q --ignore-case "gnu general public";
280-
- ! git grep -q --ignore-case "gnu library general public";
305+
- >-
306+
! grep --recursive --max-count=100 --ignore-case --exclude .travis.yml \
307+
"gnu general\|gnu lesser\|lesser general\|public license"
308+
309+
- env:
310+
- NAME=include_check
311+
script:
312+
- echo 'Checking that there are no '#include "mbed.h"' in code where it should not be'
313+
- |
314+
! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \
315+
':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \
316+
':!*tests/*' ':!*targets/*' ':!*TARGET_*' ':!*unsupported/*'
281317
282318
- env:
283319
- NAME=psa-autogen

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
Mbed OS is an open-source, device software platform for the Internet of Things. Contributions are an important part of the platform, and our goal is to make it as simple as possible to become a contributor.
44

5-
To encourage productive collaboration, as well as robust, consistent and maintainable code, we have a set of guidelines for [contributing to Mbed OS](https://os.mbed.com/docs/latest/reference/contributing.html).
5+
To encourage productive collaboration, as well as robust, consistent and maintainable code, we have a set of guidelines for [contributing to Mbed OS](https://os.mbed.com/docs/mbed-os/latest/contributing/index.html).

TESTS/host_tests/crash_reporting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_steps(self):
6060
wait_after_reset = wait_after_reset if wait_after_reset is not None else DEFAULT_CYCLE_PERIOD
6161

6262
#Wait 2 seconds for system to init
63-
time.sleep(2.0)
63+
time.sleep(7.0)
6464
#self.send_kv(MSG_KEY_SYNC, MSG_VALUE_DUMMY)
6565
self.send_kv(MSG_KEY_DEVICE_ERROR, MSG_VALUE_DUMMY)
6666
time.sleep(5.0)

TESTS/mbed_drivers/flashiap/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ void flashiap_cross_sector_program_test()
128128
agg_size += sector_size;
129129
address -= sector_size;
130130
}
131+
utest_printf("ROM ends at 0x%lx, test starts at 0x%lx\n", FLASHIAP_APP_ROM_END_ADDR, address);
131132
TEST_SKIP_UNLESS_MESSAGE(address >= FLASHIAP_APP_ROM_END_ADDR, "Test skipped. Test region overlaps code.");
132133
ret = flash_device.erase(address, agg_size);
133134
TEST_ASSERT_EQUAL_INT32(0, ret);
@@ -184,6 +185,7 @@ void flashiap_program_error_test()
184185
TEST_ASSERT_TRUE(address != 0UL);
185186

186187
// unaligned address
188+
utest_printf("ROM ends at 0x%lx, test starts at 0x%lx\n", FLASHIAP_APP_ROM_END_ADDR, address);
187189
TEST_SKIP_UNLESS_MESSAGE(address >= FLASHIAP_APP_ROM_END_ADDR, "Test skipped. Test region overlaps code.");
188190
ret = flash_device.erase(address + 1, sector_size);
189191
TEST_ASSERT_EQUAL_INT32(-1, ret);
@@ -220,6 +222,9 @@ void flashiap_timing_test()
220222
utest_printf("\nFlash timing:\n");
221223
uint32_t sector_size = flash_device.get_sector_size(end_address - 1UL);
222224
uint32_t base_address = end_address - sector_size;
225+
utest_printf("ROM ends at 0x%lx, test starts at 0x%lx\n", FLASHIAP_APP_ROM_END_ADDR, base_address);
226+
TEST_SKIP_UNLESS_MESSAGE(base_address >= FLASHIAP_APP_ROM_END_ADDR, "Test skipped. Test region overlaps code.");
227+
223228
timer.start();
224229
for (num_write_sizes = 0; num_write_sizes < max_write_sizes; num_write_sizes++) {
225230
if (write_size > sector_size) {

TESTS/mbed_hal/flash/functional_tests/main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ void flash_erase_sector_test()
175175
uint32_t last_sector_size = flash_get_sector_size(&test_flash, addr_after_last - 1);
176176
uint32_t last_sector = addr_after_last - last_sector_size;
177177
TEST_ASSERT_EQUAL_INT32(0, last_sector % last_sector_size);
178+
179+
utest_printf("ROM ends at 0x%lx, test starts at 0x%lx\n", FLASHIAP_APP_ROM_END_ADDR, last_sector);
180+
TEST_SKIP_UNLESS_MESSAGE(last_sector >= FLASHIAP_APP_ROM_END_ADDR, "Test skipped. Test region overlaps code.");
181+
178182
ret = flash_erase_sector(&test_flash, last_sector);
179183
TEST_ASSERT_EQUAL_INT32(0, ret);
180184

@@ -201,6 +205,9 @@ void flash_program_page_test()
201205

202206
// sector size might not be same as page size
203207
uint32_t erase_sector_boundary = ALIGN_DOWN(address, flash_get_sector_size(&test_flash, address));
208+
utest_printf("ROM ends at 0x%lx, test starts at 0x%lx\n", FLASHIAP_APP_ROM_END_ADDR, erase_sector_boundary);
209+
TEST_SKIP_UNLESS_MESSAGE(erase_sector_boundary >= FLASHIAP_APP_ROM_END_ADDR, "Test skipped. Test region overlaps code.");
210+
204211
ret = flash_erase_sector(&test_flash, erase_sector_boundary);
205212
TEST_ASSERT_EQUAL_INT32(0, ret);
206213

TESTS/mbed_platform/crash_reporting/main.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,17 @@ void test_crash_reporting()
5353

5454
// Report readiness
5555
greentea_send_kv(MSG_KEY_DEVICE_READY, MSG_VALUE_DUMMY);
56+
printf("\nMessage sent: %s\n", MSG_KEY_DEVICE_READY);
5657

5758
static char _key[MSG_KEY_LEN + 1] = { };
5859
static char _value[MSG_VALUE_LEN + 1] = { };
5960

61+
printf("\nWaiting for crash inject error message: %s\n", MSG_KEY_DEVICE_ERROR);
6062
greentea_parse_kv(_key, _value, MSG_KEY_LEN, MSG_VALUE_LEN);
63+
printf("\nCrash inject error message received\n");
64+
6165
if (strcmp(_key, MSG_KEY_DEVICE_ERROR) == 0) {
66+
printf("\nForcing error\n");
6267
MBED_ERROR1(MBED_ERROR_OUT_OF_MEMORY, "Executing crash reporting test.", 0xDEADBAD);
6368
TEST_ASSERT_MESSAGE(0, "crash_reporting() error call failed.");
6469
}
@@ -67,7 +72,7 @@ void test_crash_reporting()
6772

6873
int main(void)
6974
{
70-
GREENTEA_SETUP(30, "crash_reporting");
75+
GREENTEA_SETUP(40, "crash_reporting");
7176
test_crash_reporting();
7277
GREENTEA_TESTSUITE_RESULT(0);
7378

TESTS/mbedmicro-rtos-mbed/systimer/main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,10 @@ void test_handler_called_once(void)
245245
int32_t sem_slots = st.sem_wait(0);
246246
TEST_ASSERT_EQUAL_INT32(0, sem_slots);
247247

248-
sem_slots = st.sem_wait(osWaitForever);
248+
// Wait in a busy loop to prevent entering sleep or deepsleep modes.
249+
while (sem_slots != 1) {
250+
sem_slots = st.sem_wait(0);
251+
}
249252
us_timestamp_t t2 = st.get_time();
250253
TEST_ASSERT_EQUAL_INT32(1, sem_slots);
251254
TEST_ASSERT_EQUAL_UINT32(1, st.get_tick());

TESTS/netsocket/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ content at minimum:
243243
"help" : "Port of echo server",
244244
"value" : "7"
245245
}
246+
"echo-server-discard-port" : {
247+
"help" : "Discard port of echo server",
248+
"value" : "9"
249+
}
246250
}
247251
}
248252
```

TESTS/netsocket/dns/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static void net_bringup()
160160
// Test setup
161161
utest::v1::status_t test_setup(const size_t number_of_cases)
162162
{
163-
GREENTEA_SETUP(120, "default_auto");
163+
GREENTEA_SETUP(200, "default_auto");
164164
net_bringup();
165165
return verbose_test_setup_handler(number_of_cases);
166166
}

TESTS/netsocket/tcp/main.cpp

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
using namespace utest::v1;
3535

3636
namespace {
37-
NetworkInterface *net;
3837
Timer tc_bucket; // Timer to limit a test cases run time
3938
}
4039

@@ -45,11 +44,6 @@ mbed_stats_socket_t tcp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
4544
char tcp_global::rx_buffer[RX_BUFF_SIZE];
4645
char tcp_global::tx_buffer[TX_BUFF_SIZE];
4746

48-
NetworkInterface *get_interface()
49-
{
50-
return net;
51-
}
52-
5347
void drop_bad_packets(TCPSocket &sock, int orig_timeout)
5448
{
5549
nsapi_error_t err;
@@ -65,46 +59,50 @@ void drop_bad_packets(TCPSocket &sock, int orig_timeout)
6559

6660
static void _ifup()
6761
{
68-
net = NetworkInterface::get_default_instance();
62+
NetworkInterface *net = NetworkInterface::get_default_instance();
6963
nsapi_error_t err = net->connect();
7064
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
7165
printf("MBED: TCPClient IP address is '%s'\n", net->get_ip_address());
7266
}
7367

7468
static void _ifdown()
7569
{
76-
net->disconnect();
70+
NetworkInterface::get_default_instance()->disconnect();
7771
printf("MBED: ifdown\n");
7872
}
7973

80-
nsapi_error_t tcpsocket_connect_to_echo_srv(TCPSocket &sock)
74+
nsapi_error_t tcpsocket_connect_to_srv(TCPSocket &sock, uint16_t port)
8175
{
8276
SocketAddress tcp_addr;
8377

84-
get_interface()->gethostbyname(MBED_CONF_APP_ECHO_SERVER_ADDR, &tcp_addr);
85-
tcp_addr.set_port(MBED_CONF_APP_ECHO_SERVER_PORT);
78+
NetworkInterface::get_default_instance()->gethostbyname(MBED_CONF_APP_ECHO_SERVER_ADDR, &tcp_addr);
79+
tcp_addr.set_port(port);
80+
81+
printf("MBED: Server '%s', port %d\n", tcp_addr.get_ip_address(), tcp_addr.get_port());
8682

87-
nsapi_error_t err = sock.open(get_interface());
83+
nsapi_error_t err = sock.open(NetworkInterface::get_default_instance());
8884
if (err != NSAPI_ERROR_OK) {
85+
printf("Error from sock.open: %d\n", err);
8986
return err;
9087
}
9188

92-
return sock.connect(tcp_addr);
93-
}
94-
95-
nsapi_error_t tcpsocket_connect_to_discard_srv(TCPSocket &sock)
96-
{
97-
SocketAddress tcp_addr;
98-
99-
get_interface()->gethostbyname(MBED_CONF_APP_ECHO_SERVER_ADDR, &tcp_addr);
100-
tcp_addr.set_port(9);
101-
102-
nsapi_error_t err = sock.open(get_interface());
89+
err = sock.connect(tcp_addr);
10390
if (err != NSAPI_ERROR_OK) {
91+
printf("Error from sock.connect: %d\n", err);
10492
return err;
10593
}
10694

107-
return sock.connect(tcp_addr);
95+
return NSAPI_ERROR_OK;
96+
}
97+
98+
nsapi_error_t tcpsocket_connect_to_echo_srv(TCPSocket &sock)
99+
{
100+
return tcpsocket_connect_to_srv(sock, MBED_CONF_APP_ECHO_SERVER_PORT);
101+
}
102+
103+
nsapi_error_t tcpsocket_connect_to_discard_srv(TCPSocket &sock)
104+
{
105+
return tcpsocket_connect_to_srv(sock, MBED_CONF_APP_ECHO_SERVER_DISCARD_PORT);
108106
}
109107

110108
void fill_tx_buffer_ascii(char *buff, size_t len)

TESTS/netsocket/tcp/tcpsocket_bind_address.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ void TCPSOCKET_BIND_ADDRESS()
3636
TCPSocket *sock = new TCPSocket;
3737
if (!sock) {
3838
TEST_FAIL();
39+
return;
3940
}
40-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41-
SocketAddress sockAddr = SocketAddress(get_interface()->get_ip_address(), 80);
41+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance()));
42+
SocketAddress sockAddr = SocketAddress(NetworkInterface::get_default_instance()->get_ip_address(), 80);
4243
nsapi_error_t bind_result = sock->bind(sockAddr);
4344
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
4445
TEST_IGNORE_MESSAGE("bind() not supported");

TESTS/netsocket/tcp/tcpsocket_bind_address_invalid.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ void TCPSOCKET_BIND_ADDRESS_INVALID()
3636
TCPSocket *sock = new TCPSocket;
3737
if (!sock) {
3838
TEST_FAIL();
39+
return;
3940
}
40-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance()));
4142
nsapi_error_t bind_result = sock->bind("190.2.3.4", 1024);
4243
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
4344
TEST_IGNORE_MESSAGE("bind() not supported");

TESTS/netsocket/tcp/tcpsocket_bind_address_null.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ void TCPSOCKET_BIND_ADDRESS_NULL()
3636
TCPSocket *sock = new TCPSocket;
3737
if (!sock) {
3838
TEST_FAIL();
39+
return;
3940
}
40-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance()));
4142
nsapi_error_t bind_result = sock->bind(NULL, 1024);
4243
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
4344
TEST_IGNORE_MESSAGE("bind() not supported");

TESTS/netsocket/tcp/tcpsocket_bind_address_port.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ void TCPSOCKET_BIND_ADDRESS_PORT()
3636
TCPSocket *sock = new TCPSocket;
3737
if (!sock) {
3838
TEST_FAIL();
39+
return;
3940
}
40-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41-
nsapi_error_t bind_result = sock->bind(get_interface()->get_ip_address(), 80);
41+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance()));
42+
nsapi_error_t bind_result = sock->bind(NetworkInterface::get_default_instance()->get_ip_address(), 80);
4243
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
4344
TEST_IGNORE_MESSAGE("bind() not supported");
4445
} else {

TESTS/netsocket/tcp/tcpsocket_bind_port.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ void TCPSOCKET_BIND_PORT()
3636
TCPSocket *sock = new TCPSocket;
3737
if (!sock) {
3838
TEST_FAIL();
39+
return;
3940
}
40-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance()));
4142
nsapi_error_t bind_result = sock->bind(1024);
4243
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
4344
TEST_IGNORE_MESSAGE("bind() not supported");

TESTS/netsocket/tcp/tcpsocket_bind_port_fail.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ void TCPSOCKET_BIND_PORT_FAIL()
3636
TCPSocket *sock = new TCPSocket;
3737
if (!sock) {
3838
TEST_FAIL();
39+
return;
3940
}
40-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(get_interface()));
41+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance()));
4142
nsapi_error_t bind_result = sock->bind(1024);
4243
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
4344
TEST_IGNORE_MESSAGE("bind() not supported");
@@ -51,7 +52,7 @@ void TCPSOCKET_BIND_PORT_FAIL()
5152
if (!sock2) {
5253
TEST_FAIL();
5354
}
54-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock2->open(get_interface()));
55+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock2->open(NetworkInterface::get_default_instance()));
5556
TEST_ASSERT_EQUAL(NSAPI_ERROR_PARAMETER, sock2->bind(1024));
5657

5758
delete sock;

TESTS/netsocket/tcp/tcpsocket_bind_unopened.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ void TCPSOCKET_BIND_UNOPENED()
3636
TCPSocket *sock = new TCPSocket;
3737
if (!sock) {
3838
TEST_FAIL();
39+
return;
3940
}
4041
nsapi_error_t bind_result = sock->bind(1024);
4142
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {

0 commit comments

Comments
 (0)