Skip to content

Commit 62f8b92

Browse files
author
Cruz Monrreal
authored
Merge pull request #7375 from ARMmbed/release-candidate
Release candidate for mbed-os-5.9.2
2 parents 03196b2 + a2d763f commit 62f8b92

File tree

646 files changed

+21942
-9575
lines changed

Some content is hidden

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

646 files changed

+21942
-9575
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ before_install:
3030
# Setup ppa to make sure arm-none-eabi-gcc is correct version
3131
- sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
3232
- sudo add-apt-repository -y ppa:deadsnakes/ppa
33+
# Fix for "The following signatures were invalid: KEYEXPIRED 1515625755" failed". See https://github.com/travis-ci/travis-ci/issues/9037
34+
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
3335
# Loop until update succeeds (timeouts can occur)
3436
- travis_retry $(! sudo apt-get update 2>&1 |grep Failed)
3537

@@ -107,8 +109,8 @@ matrix:
107109
- env:
108110
- NAME=astyle
109111
install:
110-
- wget https://downloads.sourceforge.net/project/astyle/astyle/astyle%203.1/astyle_3.1_linux.tar.gz;
111-
mkdir -p BUILD && tar xf astyle_3.1_linux.tar.gz -C BUILD;
112+
- curl -L0 http://mbed-os.s3-eu-west-1.amazonaws.com/builds/deps/astyle_3.1_linux.tar.gz --output astyle.tar.gz;
113+
mkdir -p BUILD && tar xf astyle.tar.gz -C BUILD;
112114
pushd BUILD/astyle/build/gcc;
113115
make;
114116
export PATH=$PWD/bin:$PATH;

TESTS/mbed_drivers/timeout/timeout_tests.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,19 @@ void test_deepsleep(void)
305305
LowPowerTimer timer;
306306

307307
/*
308-
* Since deepsleep() may shut down the UART peripheral, we wait for 10ms
308+
* Since deepsleep() may shut down the UART peripheral, we wait for 20ms
309309
* to allow for hardware serial buffers to completely flush.
310+
*
311+
* Take NUMAKER_PFM_NUC472 as an example:
312+
* Its UART peripheral has 16-byte Tx FIFO. With baud rate set to 9600, flush
313+
* Tx FIFO would take: 16 * 8 * 1000 / 9600 = 13.3 (ms). So set wait time to
314+
* 20ms here for safe.
310315
311316
* This should be replaced with a better function that checks if the
312317
* hardware buffers are empty. However, such an API does not exist now,
313318
* so we'll use the wait_ms() function for now.
314319
*/
315-
wait_ms(10);
320+
wait_ms(20);
316321

317322
timer.start();
318323
timeout.attach_callback(mbed::callback(sem_callback, &sem), delay_us);

TESTS/mbed_hal/sleep/main.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,22 @@
2828

2929
#define US_PER_S 1000000
3030

31+
/* Flush serial buffer before deep sleep
32+
*
33+
* Since deepsleep() may shut down the UART peripheral, we wait for some time
34+
* to allow for hardware serial buffers to completely flush.
35+
*
36+
* Take NUMAKER_PFM_NUC472 as an example:
37+
* Its UART peripheral has 16-byte Tx FIFO. With baud rate set to 9600, flush
38+
* Tx FIFO would take: 16 * 8 * 1000 / 9600 = 13.3 (ms). So set wait time to
39+
* 20ms here for safe.
40+
*
41+
* This should be replaced with a better function that checks if the
42+
* hardware buffers are empty. However, such an API does not exist now,
43+
* so we'll use the wait_ms() function for now.
44+
*/
45+
#define SERIAL_FLUSH_TIME_MS 20
46+
3147
using namespace utest::v1;
3248

3349
/* The following ticker frequencies are possible:
@@ -167,7 +183,7 @@ void deepsleep_lpticker_test()
167183
/* Give some time Green Tea to finish UART transmission before entering
168184
* deep-sleep mode.
169185
*/
170-
wait_ms(10);
186+
wait_ms(SERIAL_FLUSH_TIME_MS);
171187

172188
TEST_ASSERT_TRUE_MESSAGE(sleep_manager_can_deep_sleep(), "deep sleep should not be locked");
173189

@@ -202,7 +218,7 @@ void deepsleep_high_speed_clocks_turned_off_test()
202218
/* Give some time Green Tea to finish UART transmission before entering
203219
* deep-sleep mode.
204220
*/
205-
wait_ms(10);
221+
wait_ms(SERIAL_FLUSH_TIME_MS);
206222

207223
TEST_ASSERT_TRUE_MESSAGE(sleep_manager_can_deep_sleep(), "deep sleep should not be locked");
208224

TESTS/mbed_platform/error_handling/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ void test_error_context_capture()
132132
TEST_ASSERT_EQUAL_UINT((uint32_t)current_thread->thread_addr, error_ctx.thread_entry_address);
133133
TEST_ASSERT_EQUAL_UINT((uint32_t)current_thread->stack_size, error_ctx.thread_stack_size);
134134
TEST_ASSERT_EQUAL_UINT((uint32_t)current_thread->stack_mem, error_ctx.thread_stack_mem);
135-
#ifdef MBED_CONF_ERROR_FILENAME_CAPTURE_ENABLED
135+
#if MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED
136136
TEST_ASSERT_EQUAL_STRING(MBED_FILENAME, error_ctx.error_filename);
137137
#endif
138138
}
139139

140-
#ifndef MBED_CONF_ERROR_HIST_DISABLED
140+
#if MBED_CONF_PLATFORM_ERROR_HIST_ENABLED
141141
/** Test error logging functionality
142142
*/
143143
void test_error_logging()
@@ -261,7 +261,7 @@ void test_error_hook()
261261
TEST_ASSERT(sem_status > 0);
262262
}
263263

264-
#ifdef MBED_TEST_SIM_BLOCKDEVICE
264+
#if MBED_CONF_PLATFORM_ERROR_HIST_ENABLED && defined(MBED_TEST_SIM_BLOCKDEVICE)
265265

266266
// test configuration
267267
#ifndef MBED_TEST_FILESYSTEM
@@ -351,12 +351,12 @@ Case cases[] = {
351351
Case("Test error context capture", test_error_context_capture),
352352
#endif //MBED_CONF_RTOS_PRESENT
353353
Case("Test error hook", test_error_hook),
354-
#ifndef MBED_CONF_ERROR_HIST_DISABLED
354+
#if MBED_CONF_PLATFORM_ERROR_HIST_ENABLED
355355
Case("Test error logging", test_error_logging),
356356
#if MBED_CONF_RTOS_PRESENT
357357
Case("Test error handling multi-threaded", test_error_logging_multithread),
358358
#endif //MBED_CONF_RTOS_PRESENT
359-
#ifdef MBED_TEST_SIM_BLOCKDEVICE
359+
#if MBED_CONF_PLATFORM_ERROR_HIST_ENABLED && defined(MBED_TEST_SIM_BLOCKDEVICE)
360360
Case("Test error save log", test_save_error_log),
361361
#endif //MBED_TEST_SIM_BLOCKDEVICE
362362
#endif //MBED_CONF_ERROR_HIST_DISABLED
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2018, ARM Limited, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
* not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "mbed.h"
19+
#include "greentea-client/test_env.h"
20+
#include "unity.h"
21+
#include "utest.h"
22+
#include "dns_tests.h"
23+
24+
using namespace utest::v1;
25+
26+
namespace {
27+
int result_ok;
28+
int result_no_mem;
29+
int result_dns_failure;
30+
int result_exp_timeout;
31+
}
32+
33+
void ASYNCHRONOUS_DNS()
34+
{
35+
do_asynchronous_gethostbyname(dns_test_hosts, 1, &result_ok, &result_no_mem, &result_dns_failure, &result_exp_timeout);
36+
37+
TEST_ASSERT(result_ok == 1);
38+
TEST_ASSERT(result_no_mem == 0);
39+
TEST_ASSERT(result_dns_failure == 0);
40+
TEST_ASSERT(result_exp_timeout == 0);
41+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright (c) 2018, ARM Limited, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
* not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "mbed.h"
19+
#include "greentea-client/test_env.h"
20+
#include "unity.h"
21+
#include "utest.h"
22+
#include "dns_tests.h"
23+
24+
using namespace utest::v1;
25+
26+
namespace {
27+
int ticker_us = 0;
28+
}
29+
30+
static void test_dns_query_ticker(void)
31+
{
32+
ticker_us += 100;
33+
}
34+
35+
void ASYNCHRONOUS_DNS_CACHE()
36+
{
37+
rtos::Semaphore semaphore;
38+
dns_application_data data;
39+
data.semaphore = &semaphore;
40+
41+
Ticker ticker;
42+
ticker.attach_us(&test_dns_query_ticker, 100);
43+
44+
for (unsigned int i = 0; i < 5; i++) {
45+
int started_us = ticker_us;
46+
47+
nsapi_error_t err = get_interface()->gethostbyname_async(dns_test_hosts[0],
48+
mbed::Callback<void(nsapi_error_t, SocketAddress *)>(hostbyname_cb, (void *) &data));
49+
TEST_ASSERT(err >= 0);
50+
51+
semaphore.wait();
52+
53+
TEST_ASSERT(data.result == NSAPI_ERROR_OK);
54+
TEST_ASSERT(strlen(data.addr.get_ip_address()) > 1);
55+
56+
int delay_ms = (ticker_us - started_us) / 1000;
57+
58+
static int delay_first = delay_ms / 2;
59+
// Check that cached accesses are at least twice as fast as the first one
60+
TEST_ASSERT_FALSE(i != 0 && delay_ms > delay_first);
61+
62+
printf("DNS: query \"%s\" => \"%s\", time %i ms\n",
63+
dns_test_hosts[0], data.addr.get_ip_address(), delay_ms);
64+
}
65+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Copyright (c) 2018, ARM Limited, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
* not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "mbed.h"
19+
#include "greentea-client/test_env.h"
20+
#include "unity.h"
21+
#include "utest.h"
22+
#include "dns_tests.h"
23+
24+
using namespace utest::v1;
25+
26+
void ASYNCHRONOUS_DNS_CANCEL()
27+
{
28+
rtos::Semaphore semaphore;
29+
dns_application_data *data = new dns_application_data[MBED_CONF_APP_DNS_TEST_HOSTS_NUM];
30+
31+
int count = 0;
32+
33+
for (unsigned int i = 0; i < MBED_CONF_APP_DNS_TEST_HOSTS_NUM; i++) {
34+
data[i].value_set = false;
35+
data[i].semaphore = &semaphore;
36+
data[i].req_result = get_interface()->gethostbyname_async(dns_test_hosts[i],
37+
mbed::Callback<void(nsapi_error_t, SocketAddress *)>(hostbyname_cb, (void *) &data[i]));
38+
TEST_ASSERT(data[i].req_result >= 0 || data[i].req_result == NSAPI_ERROR_NO_MEMORY);
39+
40+
if (data[i].req_result >= 0) {
41+
// Callback will be called
42+
count++;
43+
} else {
44+
// No memory to initiate DNS query, callback will not be called
45+
data[i].result = NSAPI_ERROR_NO_MEMORY;
46+
data[i].value_set = true;
47+
}
48+
}
49+
50+
for (unsigned int i = 0; i < MBED_CONF_APP_DNS_TEST_HOSTS_NUM; i++) {
51+
if (data[i].req_result > 0) {
52+
if (get_interface()->gethostbyname_async_cancel(data[i].req_result) == NSAPI_ERROR_OK) {
53+
count--;
54+
}
55+
}
56+
}
57+
58+
// Wait for callback(s) to complete
59+
for (int i = 0; i < count; i++) {
60+
semaphore.wait();
61+
}
62+
63+
for (unsigned int i = 0; i < MBED_CONF_APP_DNS_TEST_HOSTS_NUM; i++) {
64+
if (!data[i].value_set) {
65+
printf("DNS: query \"%s\" => cancel\n", dns_test_hosts[i]);
66+
continue;
67+
}
68+
TEST_ASSERT(data[i].result == NSAPI_ERROR_OK || data[i].result == NSAPI_ERROR_NO_MEMORY || data[i].result == NSAPI_ERROR_DNS_FAILURE || data[i].result == NSAPI_ERROR_TIMEOUT);
69+
if (data[i].result == NSAPI_ERROR_OK) {
70+
printf("DNS: query \"%s\" => \"%s\"\n",
71+
dns_test_hosts[i], data[i].addr.get_ip_address());
72+
} else if (data[i].result == NSAPI_ERROR_DNS_FAILURE) {
73+
printf("DNS: query \"%s\" => DNS failure\n", dns_test_hosts[i]);
74+
} else if (data[i].result == NSAPI_ERROR_TIMEOUT) {
75+
printf("DNS: query \"%s\" => timeout\n", dns_test_hosts[i]);
76+
} else if (data[i].result == NSAPI_ERROR_NO_MEMORY) {
77+
printf("DNS: query \"%s\" => no memory\n", dns_test_hosts[i]);
78+
}
79+
}
80+
81+
delete[] data;
82+
83+
wait(5.0);
84+
}

0 commit comments

Comments
 (0)