Skip to content

Commit 8347e76

Browse files
2 parents 68f2561 + 9ddb092 commit 8347e76

File tree

159 files changed

+4987
-1293
lines changed

Some content is hidden

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

159 files changed

+4987
-1293
lines changed

.github/pull_request_template.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1-
# Description
1+
### Description
22

3-
> Detailed changes summary | testing | dependencies
4-
> Good example: https://os.mbed.com/docs/latest/reference/guidelines.html#workflow (Pull request template)
3+
<!--
4+
Required
5+
Add here detailed changes summary, testing results, dependencies
6+
Good example: https://os.mbed.com/docs/latest/reference/guidelines.html#workflow (Pull request template)
7+
-->
58

6-
# Pull request type
9+
10+
### Pull request type
11+
12+
<!--
13+
Required
14+
Please tick one of the following types
15+
-->
716

817
- [ ] Fix
918
- [ ] Refactor
10-
- [ ] New Target
19+
- [ ] New target
1120
- [ ] Feature
21+
- [ ] Breaking change

.travis.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env:
1010
--data @- << DATA\n{
1111
"state": "$0",
1212
"description": "$1",
13-
"context": "travis-ci/$NAME/$(python --version)",
13+
"context": "travis-ci/$NAME",
1414
"target_url": "https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID"
1515
}\nDATA'
1616
@@ -74,10 +74,6 @@ matrix:
7474
7575
- env:
7676
- NAME=tools
77-
python:
78-
- '2.7'
79-
- '3.5'
80-
- '3.6'
8177
install:
8278
# Install dependencies
8379
- sudo apt-get install gcc-arm-embedded
@@ -89,7 +85,7 @@ matrix:
8985
script:
9086
# Run local testing on tools
9187
- PYTHONPATH=. coverage run -a -m pytest tools/test
92-
- python2 tools/test/pylint.py
88+
- python tools/test/pylint.py
9389
- coverage run -a tools/project.py -S | sed -n '/^Total/p'
9490
- coverage html
9591
after_success:
@@ -199,8 +195,3 @@ matrix:
199195
env: NAME=mbed2-NUVOTON
200196
- <<: *mbed-2
201197
env: NAME=mbed2-RENESAS
202-
# Change python version here only because 3x the other jobs does not add any more coverage
203-
python:
204-
- '2.7'
205-
- '3.5'
206-
- '3.6'

TESTS/host_tests/system_reset.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
"""
2+
Copyright (c) 2018 ARM Limited
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
"""
16+
import time
17+
from mbed_host_tests import BaseHostTest
18+
from mbed_host_tests.host_tests_runner.host_test_default import DefaultTestSelector
19+
20+
DEFAULT_CYCLE_PERIOD = 1.0
21+
22+
MSG_VALUE_DUMMY = '0'
23+
24+
MSG_KEY_DEVICE_READY = 'ready'
25+
MSG_KEY_DEVICE_RESET = 'reset'
26+
MSG_KEY_SYNC = '__sync'
27+
28+
class SystemResetTest(BaseHostTest):
29+
"""Test for the system_reset API.
30+
31+
Given a device running code
32+
When the device is restarted using @a system_reset()
33+
Then the device is restarted
34+
"""
35+
36+
def __init__(self):
37+
super(SystemResetTest, self).__init__()
38+
self.reset = False
39+
cycle_s = self.get_config_item('program_cycle_s')
40+
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
41+
42+
self.test_steps_sequence = self.test_steps()
43+
# Advance the coroutine to it's first yield statement.
44+
self.test_steps_sequence.send(None)
45+
46+
def setup(self):
47+
self.register_callback(MSG_KEY_DEVICE_READY, self.cb_device_ready)
48+
49+
def cb_device_ready(self, key, value, timestamp):
50+
"""Acknowledge device rebooted correctly and feed the test execution
51+
"""
52+
self.reset = True
53+
54+
try:
55+
if self.test_steps_sequence.send(value):
56+
self.notify_complete(True)
57+
except (StopIteration, RuntimeError) as exc:
58+
self.notify_complete(False)
59+
60+
def test_steps(self):
61+
"""Reset the device and check the status
62+
"""
63+
system_reset = yield
64+
65+
self.reset = False
66+
self.send_kv(MSG_KEY_DEVICE_RESET, MSG_VALUE_DUMMY)
67+
time.sleep(self.program_cycle_s)
68+
self.send_kv(MSG_KEY_SYNC, MSG_VALUE_DUMMY)
69+
70+
system_reset = yield
71+
72+
if self.reset == False:
73+
raise RuntimeError('Platform did not reset as expected.')
74+
75+
# The sequence is correct -- test passed.
76+
yield True

TESTS/mbed_hal/flash/functional_tests/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828
using namespace utest::v1;
2929

30-
#define TEST_CYCLES 1000000
31-
#define ALLOWED_DRIFT_PPM 5000 //0.5%
30+
#define TEST_CYCLES 10000000
31+
#define ALLOWED_DRIFT_PPM (1000000/5000) //0.5%
3232

3333
/*
3434
return values to be checked are documented at:
@@ -269,7 +269,7 @@ void flash_buffer_alignment_test()
269269
void flash_clock_and_cache_test()
270270
{
271271
const int timer_diff_end = time_cpu_cycles(TEST_CYCLES);
272-
const int acceptable_range = timer_diff_start / (1000000 / ALLOWED_DRIFT_PPM);
272+
const int acceptable_range = timer_diff_start / (ALLOWED_DRIFT_PPM);
273273
TEST_ASSERT_UINT32_WITHIN(acceptable_range, timer_diff_start, timer_diff_end);
274274
}
275275

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2018 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#include "mbed.h"
17+
#include "greentea-client/test_env.h"
18+
#include "unity/unity.h"
19+
20+
#define MSG_VALUE_DUMMY "0"
21+
#define MSG_VALUE_LEN 16
22+
#define MSG_KEY_LEN 16
23+
24+
#define MSG_KEY_DEVICE_READY "ready"
25+
#define MSG_KEY_DEVICE_RESET "reset"
26+
27+
void test_system_reset()
28+
{
29+
// Report readiness
30+
greentea_send_kv(MSG_KEY_DEVICE_READY, MSG_VALUE_DUMMY);
31+
32+
static char _key[MSG_KEY_LEN + 1] = { };
33+
static char _value[MSG_VALUE_LEN + 1] = { };
34+
35+
greentea_parse_kv(_key, _value, MSG_KEY_LEN, MSG_VALUE_LEN);
36+
if (strcmp(_key, MSG_KEY_DEVICE_RESET) == 0) {
37+
system_reset();
38+
TEST_ASSERT_MESSAGE(0, "system_reset() did not reset the device as expected.");
39+
}
40+
41+
TEST_ASSERT_MESSAGE(0, "Unexpected message key.");
42+
}
43+
44+
int main(void)
45+
{
46+
GREENTEA_SETUP(2, "system_reset");
47+
test_system_reset();
48+
GREENTEA_TESTSUITE_RESULT(0); // Fail on any error.
49+
50+
return 0;
51+
}

0 commit comments

Comments
 (0)