Skip to content

Commit 7c578cf

Browse files
authored
Merge pull request #9527 from bridadan/remove_yotta_references
Remove yotta references within testing frameworks
2 parents 1af3842 + 4a0bb5b commit 7c578cf

File tree

9 files changed

+35
-118
lines changed

9 files changed

+35
-118
lines changed

features/frameworks/greentea-client/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ For example, the `{{timeout;120}}}` string is a key-value message where the key
5555
## Test example
5656

5757
```c++
58+
#include "mbed.h"
5859
#include "greentea-client/test_env.h"
5960
#include "utest/utest.h"
6061
#include "unity/unity.h"
@@ -83,7 +84,7 @@ status_t greentea_setup(const size_t number_of_cases) {
8384
return greentea_test_setup_handler(number_of_cases);
8485
}
8586

86-
void app_start(int, char*[]) {
87+
void main(int, char*[]) {
8788
Harness::run(specification);
8889
}
8990
```

features/frameworks/greentea-client/greentea-client/test_env.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@
2222
#define GREENTEA_CLIENT_TEST_ENV_H_
2323

2424
#ifdef __cplusplus
25-
#ifdef YOTTA_GREENTEA_CLIENT_VERSION_STRING
26-
#define MBED_GREENTEA_CLIENT_VERSION_STRING YOTTA_GREENTEA_CLIENT_VERSION_STRING
27-
#else
2825
#define MBED_GREENTEA_CLIENT_VERSION_STRING "1.3.0"
29-
#endif
3026

3127
#include <stdio.h>
3228

@@ -41,7 +37,7 @@
4137
#endif
4238

4339
/**
44-
* Auxilary macros to keep mbed-drivers compatibility with utest before greentea-client
40+
* Ensure compatibility with utest
4541
*/
4642
#define TEST_ENV_TESTCASE_COUNT GREENTEA_TEST_ENV_TESTCASE_COUNT
4743
#define TEST_ENV_TESTCASE_START GREENTEA_TEST_ENV_TESTCASE_START

features/frameworks/greentea-client/source/greentea_test_env.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ extern bool coverage_report;
158158
*
159159
* Generates preamble of message sent to notify host about code coverage data dump.
160160
*
161-
* This function is used by mbedOS software
162-
* (see: mbed-drivers/source/retarget.cpp file) to generate code coverage
161+
* This function is used by Mbed OS
162+
* (see: mbed-os/platform/mbed_retarget.cpp) to generate code coverage
163163
* messages to host. When code coverage feature is turned on slave will
164164
* print-out code coverage data in form of key-value protocol.
165165
* Message with code coverage data will contain message name, path to code
@@ -176,8 +176,8 @@ void greentea_notify_coverage_start(const char *path) {
176176
/**
177177
* \brief Sufix for code coverage message to master (closing statement)
178178
*
179-
* This function is used by mbedOS software
180-
* (see: mbed-drivers/source/retarget.cpp file) to generate code coverage
179+
* This function is used by Mbed OS
180+
* (see: mbed-os/platform/mbed_retarget.cpp) to generate code coverage
181181
* messages to host. When code coverage feature is turned on slave will
182182
* print-out code coverage data in form of key-value protocol.
183183
* Message with code coverage data will contain message name, path to code

features/frameworks/utest/README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ The order of handler execution is:
2525

2626
## Example
2727

28-
The following example showcases a lot of functionality and proper integration with the [Greentea testing automation framework](https://github.com/ARMmbed/greentea), while making use of the [unity test macros](https://github.com/ARMmbed/mbed-os/tree/master/features/frameworks/unity):
28+
The following example showcases a lot of functionality and proper integration with the [Greentea test tool](https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-greentea), while making use of the [unity test macros](https://github.com/ARMmbed/mbed-os/tree/master/features/frameworks/unity):
2929

3030
```cpp
31-
#include "mbed-drivers/test_env.h"
31+
#include "mbed.h"
32+
#include "greentea-client/test_env.h"
3233
#include "utest/utest.h"
3334
#include "unity/unity.h"
3435

@@ -45,6 +46,7 @@ status_t test_repeats_setup(const Case *const source, const size_t index_of_case
4546
printf("Setting up for '%s'\n", source->get_description());
4647
return status;
4748
}
49+
4850
control_t test_repeats(const size_t call_count) {
4951
printf("Called for the %u. time\n", call_count);
5052
TEST_ASSERT_NOT_EQUAL(3, call_count);
@@ -58,10 +60,12 @@ void test_callback_validate() {
5860
// Validate the callback
5961
Harness::validate_callback();
6062
}
63+
6164
control_t test_asynchronous() {
6265
TEST_ASSERT_TRUE_MESSAGE(true, "(true == false) o_O");
6366
// Set up a callback in the future. This may also be an interrupt!
64-
minar::Scheduler::postCallback(test_callback_validate).delay(minar::milliseconds(100));
67+
EventQueue *queue = mbed_event_queue();
68+
queue->call_in(100, test_callback_validate);
6569
// Set a 200ms timeout starting from now
6670
return CaseTimeout(200);
6771
}
@@ -72,7 +76,8 @@ control_t test_asynchronous_timeout(const size_t call_count) {
7276
// but automatically repeat only this handler on timeout.
7377
if (call_count >= 5) {
7478
// but after the 5th call, the callback finally gets validated
75-
minar::Scheduler::postCallback(test_callback_validate).delay(minar::milliseconds(100));
79+
EventQueue *queue = mbed_event_queue();
80+
queue->call_in(100, test_callback_validate);
7681
}
7782
return CaseRepeatHandlerOnTimeout(200);
7883
}
@@ -95,7 +100,7 @@ Case cases[] = {
95100
// Declare your test specification with a custom setup handler
96101
Specification specification(greentea_setup, cases);
97102

98-
void app_start(int, char**)
103+
int main()
99104
{ // Run the test specification
100105
Harness::run(specification);
101106
}
@@ -155,7 +160,7 @@ Please see the `utest/types.h` file for a detailed description.
155160
1. `status_t case_teardown_handler_t(const Case *const source, const size_t passed, const size_t failed, const failure_t reason)`: called after execution of each test case, and if testing is aborted.
156161
1. `status_t case_failure_handler_t(const Case *const source, const failure_t reason)`: called whenever a failure occurs during the execution of a test case.
157162

158-
All handlers are defaulted for integration with the [Greentea testing automation framework](https://github.com/ARMmbed/greentea).
163+
All handlers are defaulted for integration with the [Greentea testing tool](https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-greentea).
159164

160165
### Test Case Handlers
161166

@@ -416,4 +421,4 @@ void main() // or whatever your custom entry point is
416421
}
417422
}
418423
}
419-
```
424+
```

features/frameworks/utest/TESTS/unit_tests/minimal_async_scheduler/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
// define this to get rid of the minar dependency.
19-
#define YOTTA_CFG_UTEST_USE_CUSTOM_SCHEDULER 1
2018

2119
#include "mbed.h"
2220
#include "greentea-client/test_env.h"

features/frameworks/utest/TESTS/unit_tests/minimal_scheduler/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
// define this to get rid of the minar dependency.
19-
#define YOTTA_CFG_UTEST_USE_CUSTOM_SCHEDULER 1
2018

2119
#include "mbed.h"
2220
#include "greentea-client/test_env.h"

features/frameworks/utest/source/utest_shim.cpp

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -18,50 +18,9 @@
1818

1919
#include "utest/utest_shim.h"
2020
#include "utest/utest_stack_trace.h"
21-
22-
#if UTEST_SHIM_SCHEDULER_USE_MINAR
23-
#include "minar/minar.h"
24-
25-
static int32_t utest_minar_init()
26-
{
27-
return 0;
28-
}
29-
static void *utest_minar_post(const utest_v1_harness_callback_t callback, const uint32_t delay_ms)
30-
{
31-
void *handle = minar::Scheduler::postCallback(callback).delay(minar::milliseconds(delay_ms)).getHandle();
32-
return handle;
33-
}
34-
static int32_t utest_minar_cancel(void *handle)
35-
{
36-
int32_t ret = minar::Scheduler::cancelCallback(handle);
37-
return ret;
38-
}
39-
static int32_t utest_minar_run()
40-
{
41-
return 0;
42-
}
43-
extern "C" {
44-
static const utest_v1_scheduler_t utest_v1_scheduler =
45-
{
46-
utest_minar_init,
47-
utest_minar_post,
48-
utest_minar_cancel,
49-
utest_minar_run
50-
};
51-
utest_v1_scheduler_t utest_v1_get_scheduler()
52-
{
53-
return utest_v1_scheduler;
54-
}
55-
}
56-
57-
#elif UTEST_SHIM_SCHEDULER_USE_US_TICKER
58-
#ifdef YOTTA_MBED_HAL_VERSION_STRING
59-
# include "mbed-hal/us_ticker_api.h"
60-
#else
6121
#include "platform/SingletonPtr.h"
6222
#include "Timeout.h"
6323
using mbed::Timeout;
64-
#endif
6524

6625
// only one callback is active at any given time
6726
static volatile utest_v1_harness_callback_t minimal_callback;
@@ -79,7 +38,7 @@ static void ticker_handler()
7938
static int32_t utest_us_ticker_init()
8039
{
8140
UTEST_LOG_FUNCTION();
82-
// initialize the Timeout object to makes sure it is not initialized in
41+
// initialize the Timeout object to makes sure it is not initialized in
8342
// interrupt context.
8443
utest_timeout_object.get();
8544
return 0;
@@ -88,13 +47,13 @@ static void *utest_us_ticker_post(const utest_v1_harness_callback_t callback, ti
8847
{
8948
UTEST_LOG_FUNCTION();
9049
timestamp_t delay_us = delay_ms *1000;
91-
50+
9251
if (delay_ms) {
9352
ticker_callback = callback;
9453
// fire the interrupt in 1000us * delay_ms
9554
utest_timeout_object->attach_us(ticker_handler, delay_us);
96-
97-
}
55+
56+
}
9857
else {
9958
minimal_callback = callback;
10059
}
@@ -142,10 +101,3 @@ utest_v1_scheduler_t utest_v1_get_scheduler()
142101
return utest_v1_scheduler;
143102
}
144103
}
145-
#endif
146-
147-
#ifdef YOTTA_CORE_UTIL_VERSION_STRING
148-
// their functionality is implemented using the CriticalSectionLock class
149-
void utest_v1_enter_critical_section(void) {}
150-
void utest_v1_leave_critical_section(void) {}
151-
#endif

features/frameworks/utest/utest/utest_harness.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ namespace v1 {
4141
* The harness executes the test specification in an asynchronous fashion, therefore
4242
* `run()` returns immediately.
4343
*
44-
* By default, this harness uses the MINAR scheduler for asynchronous callbacks.
45-
* If you wamt to provide your own custom scheduler, set `config.utest.use_custom_scheduler` to `true`
46-
* inside your yotta config and set a custom scheduler implementation using the `set_scheduler()` function.
47-
* You must set the scheduler before running a specification.
48-
*
4944
* @note In case of an test abort, the harness will busy-wait and never finish.
5045
*/
5146
class Harness

features/frameworks/utest/utest/utest_shim.h

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,50 +27,22 @@
2727
#include <stdio.h>
2828
#include "utest/utest_scheduler.h"
2929

30-
#ifdef YOTTA_CFG
31-
# include "compiler-polyfill/attributes.h"
32-
#else
33-
# ifndef __deprecated_message
34-
# if defined(__CC_ARM)
35-
# define __deprecated_message(msg) __attribute__((deprecated))
36-
# elif defined (__ICCARM__)
37-
# define __deprecated_message(msg)
38-
# else
39-
# define __deprecated_message(msg) __attribute__((deprecated(msg)))
40-
# endif
30+
#ifndef __deprecated_message
31+
# if defined(__CC_ARM)
32+
# define __deprecated_message(msg) __attribute__((deprecated))
33+
# elif defined (__ICCARM__)
34+
# define __deprecated_message(msg)
35+
# else
36+
# define __deprecated_message(msg) __attribute__((deprecated(msg)))
4137
# endif
4238
#endif
4339

44-
#ifdef YOTTA_CORE_UTIL_VERSION_STRING
45-
# include "core-util/CriticalSectionLock.h"
46-
# define UTEST_ENTER_CRITICAL_SECTION mbed::util::CriticalSectionLock lock
47-
# define UTEST_LEAVE_CRITICAL_SECTION
48-
#else
49-
# ifndef UTEST_ENTER_CRITICAL_SECTION
50-
# define UTEST_ENTER_CRITICAL_SECTION utest_v1_enter_critical_section()
51-
# endif
52-
# ifndef UTEST_LEAVE_CRITICAL_SECTION
53-
# define UTEST_LEAVE_CRITICAL_SECTION utest_v1_leave_critical_section()
54-
# endif
40+
#ifndef UTEST_ENTER_CRITICAL_SECTION
41+
# define UTEST_ENTER_CRITICAL_SECTION utest_v1_enter_critical_section()
42+
#endif
43+
#ifndef UTEST_LEAVE_CRITICAL_SECTION
44+
# define UTEST_LEAVE_CRITICAL_SECTION utest_v1_leave_critical_section()
5545
#endif
56-
57-
#ifndef YOTTA_CFG_UTEST_USE_CUSTOM_SCHEDULER
58-
# ifdef YOTTA_MINAR_VERSION_STRING
59-
# define UTEST_MINAR_AVAILABLE 1
60-
# else
61-
# define UTEST_MINAR_AVAILABLE 0
62-
# endif
63-
# ifndef UTEST_SHIM_SCHEDULER_USE_MINAR
64-
# define UTEST_SHIM_SCHEDULER_USE_MINAR UTEST_MINAR_AVAILABLE
65-
# endif
66-
# ifndef UTEST_SHIM_SCHEDULER_USE_US_TICKER
67-
# ifdef __MBED__
68-
# define UTEST_SHIM_SCHEDULER_USE_US_TICKER 1
69-
# else
70-
# define UTEST_SHIM_SCHEDULER_USE_US_TICKER 0
71-
# endif
72-
# endif
73-
#endif // YOTTA_CFG_UTEST_USE_CUSTOM_SCHEDULER
7446

7547
#ifdef __cplusplus
7648
extern "C" {

0 commit comments

Comments
 (0)