Skip to content

Fix echo test handshake and reduce uart load #5272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions TESTS/mbed_drivers/echo/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@ using namespace utest::v1;
// Echo server (echo payload to host)
template<int N>
void test_case_echo_server_x() {
char _key[10] = {};
char _key[11] = {};
char _value[128] = {};
const int echo_count = N;
const char _key_const[] = "echo_count";
int expected_key = 1;

greentea_send_kv(_key_const, echo_count);
// Handshake with host
greentea_send_kv("echo_count", echo_count);
greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
do {
greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
expected_key = strcmp(_key_const, _key);
} while (expected_key);
TEST_ASSERT_EQUAL_INT(echo_count, atoi(_value));

for (int i=0; i < echo_count; ++i) {
Expand All @@ -48,12 +53,10 @@ utest::v1::status_t greentea_failure_handler(const Case *const source, const fai

Case cases[] = {
Case("Echo server: x16", test_case_echo_server_x<16>, greentea_failure_handler),
Case("Echo server: x32", test_case_echo_server_x<32>, greentea_failure_handler),
Case("Echo server: x64", test_case_echo_server_x<64>, greentea_failure_handler),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok, I'm guessing if any failures were to crop up in these cases it'd be a DAPlink related issue.

cc @c1728p9

};

utest::v1::status_t greentea_test_setup(const size_t number_of_cases) {
GREENTEA_SETUP(180, "echo");
GREENTEA_SETUP(30, "echo");
return greentea_test_setup_handler(number_of_cases);
}

Expand Down