mbed-rtos test programs for DISCO_F746NG. #Test for thread, mutex, semaphore, signals, queues, mail, ISR
Dependencies: BSP_DISCO_F746NG HC06Bluetooth I2Cdev LCD_DISCO_F746NG MCP2515 MD25 MPU9150 TS_DISCO_F746NG emwin mbed-dev mbed-rtos pca9685 ppCANOpen ros_lib_kinetic
Fork of DISCO-F746NG_rtos_test by
test_env.h@0:225c1da086a1, 2015-11-11 (annotated)
- Committer:
- mzta
- Date:
- Wed Nov 11 07:53:46 2015 +0000
- Revision:
- 0:225c1da086a1
Initial commit.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mzta | 0:225c1da086a1 | 1 | #ifndef TEST_ENV_H_ |
mzta | 0:225c1da086a1 | 2 | #define TEST_ENV_H_ |
mzta | 0:225c1da086a1 | 3 | |
mzta | 0:225c1da086a1 | 4 | #include <stdio.h> |
mzta | 0:225c1da086a1 | 5 | #include "mbed.h" |
mzta | 0:225c1da086a1 | 6 | |
mzta | 0:225c1da086a1 | 7 | #define NL "\n" |
mzta | 0:225c1da086a1 | 8 | #define RCNL "\r\n" |
mzta | 0:225c1da086a1 | 9 | |
mzta | 0:225c1da086a1 | 10 | // Const strings used in test_end |
mzta | 0:225c1da086a1 | 11 | extern const char* TEST_ENV_START; |
mzta | 0:225c1da086a1 | 12 | extern const char* TEST_ENV_SUCCESS; |
mzta | 0:225c1da086a1 | 13 | extern const char* TEST_ENV_FAILURE; |
mzta | 0:225c1da086a1 | 14 | extern const char* TEST_ENV_MEASURE; |
mzta | 0:225c1da086a1 | 15 | extern const char* TEST_ENV_END; |
mzta | 0:225c1da086a1 | 16 | |
mzta | 0:225c1da086a1 | 17 | // Test result related notification functions |
mzta | 0:225c1da086a1 | 18 | void notify_start(); |
mzta | 0:225c1da086a1 | 19 | void notify_completion(bool success); |
mzta | 0:225c1da086a1 | 20 | bool notify_completion_str(bool success, char* buffer); |
mzta | 0:225c1da086a1 | 21 | void notify_performance_coefficient(const char* measurement_name, const int value); |
mzta | 0:225c1da086a1 | 22 | void notify_performance_coefficient(const char* measurement_name, const unsigned int value); |
mzta | 0:225c1da086a1 | 23 | void notify_performance_coefficient(const char* measurement_name, const double value); |
mzta | 0:225c1da086a1 | 24 | |
mzta | 0:225c1da086a1 | 25 | // Host test auto-detection API |
mzta | 0:225c1da086a1 | 26 | void notify_host_test_name(const char *host_test); |
mzta | 0:225c1da086a1 | 27 | void notify_timeout(int timeout); |
mzta | 0:225c1da086a1 | 28 | void notify_test_id(const char *test_id); |
mzta | 0:225c1da086a1 | 29 | void notify_test_description(const char *description); |
mzta | 0:225c1da086a1 | 30 | |
mzta | 0:225c1da086a1 | 31 | // Host test auto-detection API |
mzta | 0:225c1da086a1 | 32 | #define MBED_HOSTTEST_START(TESTID) notify_test_id(TESTID); notify_start() |
mzta | 0:225c1da086a1 | 33 | #define MBED_HOSTTEST_SELECT(NAME) notify_host_test_name(#NAME) |
mzta | 0:225c1da086a1 | 34 | #define MBED_HOSTTEST_TIMEOUT(SECONDS) notify_timeout(SECONDS) |
mzta | 0:225c1da086a1 | 35 | #define MBED_HOSTTEST_DESCRIPTION(DESC) notify_test_description(#DESC) |
mzta | 0:225c1da086a1 | 36 | #define MBED_HOSTTEST_RESULT(RESULT) notify_completion(RESULT) |
mzta | 0:225c1da086a1 | 37 | |
mzta | 0:225c1da086a1 | 38 | /** |
mzta | 0:225c1da086a1 | 39 | Test auto-detection preamble example: |
mzta | 0:225c1da086a1 | 40 | main() { |
mzta | 0:225c1da086a1 | 41 | MBED_HOSTTEST_TIMEOUT(10); |
mzta | 0:225c1da086a1 | 42 | MBED_HOSTTEST_SELECT( host_test ); |
mzta | 0:225c1da086a1 | 43 | MBED_HOSTTEST_DESCRIPTION(Hello World); |
mzta | 0:225c1da086a1 | 44 | MBED_HOSTTEST_START("MBED_10"); |
mzta | 0:225c1da086a1 | 45 | // Proper 'host_test.py' should take over supervising of this test |
mzta | 0:225c1da086a1 | 46 | |
mzta | 0:225c1da086a1 | 47 | // Test code |
mzta | 0:225c1da086a1 | 48 | bool result = ...; |
mzta | 0:225c1da086a1 | 49 | |
mzta | 0:225c1da086a1 | 50 | MBED_HOSTTEST_RESULT(result); |
mzta | 0:225c1da086a1 | 51 | } |
mzta | 0:225c1da086a1 | 52 | */ |
mzta | 0:225c1da086a1 | 53 | |
mzta | 0:225c1da086a1 | 54 | |
mzta | 0:225c1da086a1 | 55 | // Test functionality useful during testing |
mzta | 0:225c1da086a1 | 56 | unsigned int testenv_randseed(); |
mzta | 0:225c1da086a1 | 57 | |
mzta | 0:225c1da086a1 | 58 | // Macros, unit test like to provide basic comparisons |
mzta | 0:225c1da086a1 | 59 | #define TESTENV_STRCMP(GIVEN,EXPECTED) (strcmp(GIVEN,EXPECTED) == 0) |
mzta | 0:225c1da086a1 | 60 | |
mzta | 0:225c1da086a1 | 61 | // macros passed via test suite |
mzta | 0:225c1da086a1 | 62 | #ifndef TEST_SUITE_TARGET_NAME |
mzta | 0:225c1da086a1 | 63 | #define TEST_SUITE_TARGET_NAME "Unknown" |
mzta | 0:225c1da086a1 | 64 | #endif |
mzta | 0:225c1da086a1 | 65 | |
mzta | 0:225c1da086a1 | 66 | #ifndef TEST_SUITE_TEST_ID |
mzta | 0:225c1da086a1 | 67 | #define TEST_SUITE_TEST_ID "Unknown" |
mzta | 0:225c1da086a1 | 68 | #endif |
mzta | 0:225c1da086a1 | 69 | |
mzta | 0:225c1da086a1 | 70 | #ifndef TEST_SUITE_UUID |
mzta | 0:225c1da086a1 | 71 | #define TEST_SUITE_UUID "Unknown" |
mzta | 0:225c1da086a1 | 72 | #endif |
mzta | 0:225c1da086a1 | 73 | |
mzta | 0:225c1da086a1 | 74 | #endif |
mzta | 0:225c1da086a1 | 75 |