From 1e79d929bf08a2da91069ba5a5d9c6d1eccb3c1e Mon Sep 17 00:00:00 2001 From: Przemek Wirkus Date: Thu, 20 Mar 2014 15:52:06 +0000 Subject: [PATCH] Added MBED_16 RTC host test automation (5 reads from RTC) --- libraries/tests/mbed/rtc/main.cpp | 17 ++++++----------- libraries/tests/mbed/sleep_timeout/main.cpp | 6 ++++-- workspace_tools/tests.py | 3 +++ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libraries/tests/mbed/rtc/main.cpp b/libraries/tests/mbed/rtc/main.cpp index 1328d5b209..a69fd68efc 100644 --- a/libraries/tests/mbed/rtc/main.cpp +++ b/libraries/tests/mbed/rtc/main.cpp @@ -1,19 +1,14 @@ #include "mbed.h" -int main() { - set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37 +#define CUSTOM_TIME 1256729737 +int main() { + char buffer[32] = {0}; + set_time(CUSTOM_TIME); // Set RTC time to Wed, 28 Oct 2009 11:35:37 while(1) { time_t seconds = time(NULL); - - printf("Time as seconds since January 1, 1970 = %d\n", seconds); - - printf("Time as a basic string = %s", ctime(&seconds)); - - char buffer[32]; - strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds)); - printf("Time as a custom formatted string = %s", buffer); - + strftime(buffer, 32, "%Y-%m-%d %H:%M:%S %p", localtime(&seconds)); + printf("[%d] [%s]\n", seconds, buffer); wait(1); } } diff --git a/libraries/tests/mbed/sleep_timeout/main.cpp b/libraries/tests/mbed/sleep_timeout/main.cpp index 89a011e47d..0f8adbfb87 100644 --- a/libraries/tests/mbed/sleep_timeout/main.cpp +++ b/libraries/tests/mbed/sleep_timeout/main.cpp @@ -6,12 +6,14 @@ Timeout to1; Timeout to2; void led1_on() { - led1 = 1; + led1 = !led1; printf("led1\n\r"); + fflush(stdout); } void led2_on() { - led2 = 1; + led2 = !led2; printf("led2\n\r"); + fflush(stdout); } int main() { diff --git a/workspace_tools/tests.py b/workspace_tools/tests.py index 7d263c9d5c..ca9bc3fa69 100644 --- a/workspace_tools/tests.py +++ b/workspace_tools/tests.py @@ -350,6 +350,9 @@ TESTS = [ "id": "MBED_16", "description": "RTC", "source_dir": join(TEST_DIR, "mbed", "rtc"), "dependencies": [MBED_LIBRARIES], + "automated": True, + "host_test": "rtc_auto", + "duration": 15 }, { "id": "MBED_17", "description": "Serial Interrupt 2",