summaryrefslogtreecommitdiff
path: root/cts/i2c
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2017-06-22 14:36:24 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-06-27 15:52:06 -0700
commita82421df00ac1834d0dc8a93f788c323b1bf1977 (patch)
tree3ce0268be0e05e9b53a6afe5565bbf3cf6e8a06d /cts/i2c
parent4c23fa01df623438e7d2bfe51dec6eac4f7d9ff2 (diff)
downloadchrome-ec-a82421df00ac1834d0dc8a93f788c323b1bf1977.tar.gz
eCTS: Print start marker before sync
This patch makes each test print start marker before sync. This will allow us to distinguish the failure before even sync is attempted (CTS_RC_DID_NOT_START, thus probably caused by the previous test) and the failure caused by the hanging partner, in which case the one good and alive will be stuck in sync (and should return _DID_NOT_END or even better _BAD_SYNC once we implement timeout in sync). This patch also: * Adds did_not_start_test to and removes debug_test from meta suite * Consolidates test runner loops into common cts_main_loop * Removes dut_common.h and th_common.h * Removes debug print macro and CTS_DEBUG * Replaces all infinite loops after tests with task_wait_event(-1) * Removes meaningless comments and debug printfs * Removes CTS_TEST_ID_* * Adds sync() to task suite BUG=chromium:736104 BRANCH=none TEST=Run run_ects.sh and verify all tests pass Change-Id: I6ccdf26afac6b8e8cb16483c5d75e4e77e7962f4 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/545176
Diffstat (limited to 'cts/i2c')
-rw-r--r--cts/i2c/dut.c19
-rw-r--r--cts/i2c/th.c24
2 files changed, 7 insertions, 36 deletions
diff --git a/cts/i2c/dut.c b/cts/i2c/dut.c
index b629475ffa..98805a4fc2 100644
--- a/cts/i2c/dut.c
+++ b/cts/i2c/dut.c
@@ -6,9 +6,9 @@
#include "common.h"
#include "cts_common.h"
#include "cts_i2c.h"
-#include "dut_common.h"
#include "i2c.h"
#include "registers.h"
+#include "task.h"
#include "timer.h"
#include "uart.h"
#include "watchdog.h"
@@ -86,19 +86,6 @@ enum cts_rc read32_test(void)
void cts_task(void)
{
- int i;
-
- cflush();
- for (i = 0; i < CTS_TEST_ID_COUNT; i++) {
- sync();
- CPRINTF("\n%s %d\n", tests[i].name, tests[i].run());
- uart_flush_output();
- }
-
- CPRINTS("I2C test suite finished");
- uart_flush_output();
- while (1) {
- watchdog_reload();
- sleep(1);
- }
+ cts_main_loop(tests, "I2C");
+ task_wait_event(-1);
}
diff --git a/cts/i2c/th.c b/cts/i2c/th.c
index 86c3a2c8de..17ed64b9f5 100644
--- a/cts/i2c/th.c
+++ b/cts/i2c/th.c
@@ -7,9 +7,9 @@
#include "common.h"
#include "cts_common.h"
#include "cts_i2c.h"
-#include "dut_common.h"
#include "i2c.h"
#include "registers.h"
+#include "task.h"
#include "timer.h"
#include "uart.h"
#include "watchdog.h"
@@ -61,7 +61,7 @@ static int wait_for_in_flag(uint32_t timeout_ms)
return 1;
}
-static void clear_inbox(void)
+void clean_state(void)
{
memset(inbox, 0, sizeof(inbox));
data_received = 0;
@@ -146,22 +146,6 @@ enum cts_rc read32_test(void)
void cts_task(void)
{
- enum cts_rc result;
- int i;
-
- cflush();
- for (i = 0; i < CTS_TEST_ID_COUNT; i++) {
- clear_inbox();
- sync();
- result = tests[i].run();
- CPRINTF("\n%s %d\n", tests[i].name, result);
- uart_flush_output();
- }
-
- CPRINTS("I2C test suite finished");
- uart_flush_output();
- while (1) {
- watchdog_reload();
- sleep(1);
- }
+ cts_main_loop(tests, "I2C");
+ task_wait_event(-1);
}