mirror of https://github.com/ARMmbed/mbed-os.git
Adding ability to preserve Greentea UUID in test.
The Greentea UUID can be used as a source of entropy/randomness during the test. This is useful for uniquely identifying a test run.pull/4369/head
parent
98a5262361
commit
551ff03dc0
|
@ -77,6 +77,7 @@ extern const char* GREENTEA_TEST_ENV_LCOV_START;
|
|||
* Greentea-client related API for communication with host side
|
||||
*/
|
||||
void GREENTEA_SETUP(const int, const char *);
|
||||
void GREENTEA_SETUP_UUID(const int timeout, const char *host_test_name, char *buffer, size_t size);
|
||||
void GREENTEA_TESTSUITE_RESULT(const int);
|
||||
void GREENTEA_TESTCASE_START(const char *test_case_name);
|
||||
void GREENTEA_TESTCASE_FINISH(const char *test_case_name, const size_t passes, const size_t failed);
|
||||
|
|
|
@ -60,25 +60,21 @@ static void greentea_notify_completion(const int);
|
|||
static void greentea_notify_version();
|
||||
static void greentea_write_string(const char *str);
|
||||
|
||||
/** \brief Handshake with host and send setup data (timeout and host test name)
|
||||
* \details This function will send preamble to master.
|
||||
* After host test name is received master will invoke host test script
|
||||
* and add hos test's callback handlers to main event loop
|
||||
* This function is blocking.
|
||||
*/
|
||||
void GREENTEA_SETUP(const int timeout, const char *host_test_name) {
|
||||
|
||||
void _GREENTEA_SETUP_COMMON(const int timeout, const char *host_test_name, char *buffer, size_t size) {
|
||||
greentea_metrics_setup();
|
||||
// Key-value protocol handshake function. Waits for {{__sync;...}} message
|
||||
// Sync preamble: "{{__sync;0dad4a9d-59a3-4aec-810d-d5fb09d852c1}}"
|
||||
// Example value of sync_uuid == "0dad4a9d-59a3-4aec-810d-d5fb09d852c1"
|
||||
|
||||
char _key[8] = {0};
|
||||
char _value[48] = {0};
|
||||
|
||||
while (1) {
|
||||
greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
|
||||
greentea_parse_kv(_key, buffer, sizeof(_key), size);
|
||||
greentea_write_string("mbedmbedmbedmbedmbedmbedmbedmbed\r\n");
|
||||
if (strcmp(_key, GREENTEA_TEST_ENV_SYNC) == 0) {
|
||||
// Found correct __sunc message
|
||||
greentea_send_kv(_key, _value);
|
||||
greentea_send_kv(_key, buffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +84,27 @@ void GREENTEA_SETUP(const int timeout, const char *host_test_name) {
|
|||
greentea_notify_hosttest(host_test_name);
|
||||
}
|
||||
|
||||
/** \brief Handshake with host and send setup data (timeout and host test name)
|
||||
* \details This function will send preamble to master.
|
||||
* After host test name is received master will invoke host test script
|
||||
* and add hos test's callback handlers to main event loop
|
||||
* This function is blocking.
|
||||
*/
|
||||
void GREENTEA_SETUP(const int timeout, const char *host_test_name) {
|
||||
char _value[48] = {0};
|
||||
_GREENTEA_SETUP_COMMON(timeout, host_test_name, _value, 48);
|
||||
}
|
||||
|
||||
/** \brief Handshake with host and send setup data (timeout and host test name)
|
||||
* \details This function will send preamble to master.
|
||||
* After host test name is received master will invoke host test script
|
||||
* and add hos test's callback handlers to main event loop
|
||||
* This function is blocking.
|
||||
*/
|
||||
void GREENTEA_SETUP_UUID(const int timeout, const char *host_test_name, char *buffer, size_t size) {
|
||||
_GREENTEA_SETUP_COMMON(timeout, host_test_name, buffer, size);
|
||||
}
|
||||
|
||||
/** \brief Notify host (__exit message) side that test suite execution was complete
|
||||
* \result Test suite result
|
||||
* \details If __exit is not received by host side we will assume TIMEOUT
|
||||
|
|
Loading…
Reference in New Issue