summaryrefslogtreecommitdiff
path: root/cts/meta
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/meta
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/meta')
-rw-r--r--cts/meta/cts.testlist54
-rw-r--r--cts/meta/dut.c36
-rw-r--r--cts/meta/th.c47
3 files changed, 47 insertions, 90 deletions
diff --git a/cts/meta/cts.testlist b/cts/meta/cts.testlist
index d453d33e51..443f1b7376 100644
--- a/cts/meta/cts.testlist
+++ b/cts/meta/cts.testlist
@@ -3,50 +3,50 @@
* found in the LICENSE file.
*/
-/* Currently tests will execute in the order they are listed here */
-
-/* Test should succeed show the following debug output:
- * You should see #'s 1-4 on sequential lines:
- * 1
- * 2
- * 3
- * 4
- */
-CTS_TEST(debug_test,,,,)
-
-/* Test should succeed if both report success
- * (expected result: success)
+/*
+ * Test SUCCESS from both TH and DUT
*/
CTS_TEST(success_test,,,,)
-/* Test should fail if one reports success and
- * (one reports failure (expected result: failure)
+/*
+ * Test FAILURE from DUT
*/
CTS_TEST(fail_dut_test,,, CTS_RC_FAILURE,)
-/* Test should fail if one reports success and
- * (one reports failure (expected result: failure)
+/*
+ * Test FAILURE from TH
*/
CTS_TEST(fail_th_test, CTS_RC_FAILURE,,,)
-/* Test should fail when both boards report failure
- * (expected result: failure)
+/*
+ * Test failure from both TH and DUT.
*/
CTS_TEST(fail_both_test, CTS_RC_FAILURE,, CTS_RC_FAILURE,)
-/* Test should fail with bad sync if one reports bad
- * sync and the other reports success (expected result:
- * bad_sync)
+/*
+ * Test bad sync for TH
*/
CTS_TEST(bad_sync_and_success_test, CTS_RC_BAD_SYNC,,,)
-/* Test should fail with bad sync if both boards report
- * bad sync (expected result: bad_sync)
+/*
+ * Test should fail with bad sync.
*/
CTS_TEST(bad_sync_both_test, CTS_RC_BAD_SYNC,, CTS_RC_BAD_SYNC,)
-/* Test should be listed as corrupted if one test hangs,
- * regardless of what the other test outputs
- * (expected result: corrupted)
+/*
+ * Test hang on DUT
*/
CTS_TEST(hang_test, CTS_RC_SUCCESS,, CTS_RC_DID_NOT_END,)
+
+/*
+ * Test CTS_RC_DID_NOT_START
+ *
+ * Since the previous test hung on DUT, this test won't run on DUT.
+ * TH will wait forever in sync(), thus won't end.
+ */
+ CTS_TEST(did_not_start_test, CTS_RC_DID_NOT_END,, CTS_RC_DID_NOT_START,)
+
+/*
+ * TODO: Add test for expected string
+ * TODO: Make sync() return CTS_RC_BAD_SYNC when it times out.
+ */ \ No newline at end of file
diff --git a/cts/meta/dut.c b/cts/meta/dut.c
index b80628449b..c8264ab868 100644
--- a/cts/meta/dut.c
+++ b/cts/meta/dut.c
@@ -4,16 +4,11 @@
*/
#include "common.h"
-#include "uart.h"
+#include "cts_common.h"
+#include "task.h"
#include "timer.h"
+#include "uart.h"
#include "watchdog.h"
-#include "dut_common.h"
-#include "cts_common.h"
-
-enum cts_rc debug_test(void)
-{
- return CTS_RC_SUCCESS;
-}
enum cts_rc success_test(void)
{
@@ -55,26 +50,15 @@ enum cts_rc hang_test(void)
return CTS_RC_SUCCESS;
}
+enum cts_rc did_not_start_test(void)
+{
+ return CTS_RC_SUCCESS;
+}
+
#include "cts_testlist.h"
void cts_task(void)
{
- enum cts_rc result;
- int i;
-
- cflush();
- for (i = 0; i < CTS_TEST_ID_COUNT; i++) {
- sync();
- CPRINTF("\n%s start\n", tests[i].name);
- result = tests[i].run();
- CPRINTF("\n%s end %d\n", tests[i].name, result);
- cflush();
- }
-
- CPRINTS("Meta test finished");
- cflush();
- while (1) {
- watchdog_reload();
- sleep(1);
- }
+ cts_main_loop(tests, "Meta");
+ task_wait_event(-1);
}
diff --git a/cts/meta/th.c b/cts/meta/th.c
index c1331ff2a7..8564377b7f 100644
--- a/cts/meta/th.c
+++ b/cts/meta/th.c
@@ -4,60 +4,49 @@
*/
#include "common.h"
-#include "uart.h"
+#include "cts_common.h"
+#include "task.h"
#include "timer.h"
+#include "uart.h"
#include "watchdog.h"
-#include "dut_common.h"
-#include "cts_common.h"
-
-enum cts_rc debug_test(void)
-{
- CTS_DEBUG_PRINTF("You should see #'s 1-4 on sequential lines:");
- CTS_DEBUG_PRINTF("1");
- CTS_DEBUG_PRINTF("2\n3");
- CTS_DEBUG_PRINTF("4");
- return CTS_RC_SUCCESS;
-}
enum cts_rc success_test(void)
{
- CTS_DEBUG_PRINTF("Expect: Success");
return CTS_RC_SUCCESS;
}
enum cts_rc fail_dut_test(void)
{
- CTS_DEBUG_PRINTF("Expect: Failure");
return CTS_RC_SUCCESS;
}
enum cts_rc fail_th_test(void)
{
- CTS_DEBUG_PRINTF("Expect: Failure");
return CTS_RC_FAILURE;
}
enum cts_rc fail_both_test(void)
{
- CTS_DEBUG_PRINTF("Expect: Failure");
return CTS_RC_FAILURE;
}
enum cts_rc bad_sync_and_success_test(void)
{
- CTS_DEBUG_PRINTF("Expect: Bad Sync");
return CTS_RC_BAD_SYNC;
}
enum cts_rc bad_sync_both_test(void)
{
- CTS_DEBUG_PRINTF("Expect: Bad Sync");
return CTS_RC_BAD_SYNC;
}
enum cts_rc hang_test(void)
{
- CTS_DEBUG_PRINTF("This and next, expect: Corrupted");
+ return CTS_RC_SUCCESS;
+}
+
+enum cts_rc did_not_start_test(void)
+{
return CTS_RC_SUCCESS;
}
@@ -65,22 +54,6 @@ enum cts_rc hang_test(void)
void cts_task(void)
{
- enum cts_rc result;
- int i;
-
- cflush();
- for (i = 0; i < CTS_TEST_ID_COUNT; i++) {
- sync();
- CPRINTF("\n%s start\n", tests[i].name);
- result = tests[i].run();
- CPRINTF("\n%s end %d\n", tests[i].name, result);
- cflush();
- }
-
- CPRINTS("Meta test finished");
- cflush();
- while (1) {
- watchdog_reload();
- sleep(1);
- }
+ cts_main_loop(tests, "Meta");
+ task_wait_event(-1);
}