Files
OpenCellular/cts/common/cts_common.h
Daisuke Nojiri a82421df00 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
2017-06-27 15:52:06 -07:00

56 lines
1.2 KiB
C

/* Copyright 2016 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef __CTS_COMMON_H
#define __CTS_COMMON_H
#include "console.h"
/* Console output macros */
#define CPUTS(outstr) cputs(CC_SYSTEM, outstr)
#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
#define CPRINTL(format, args...) CPRINTS("%s:%d: "format, \
__func__, __LINE__, ## args)
#define READ_WAIT_TIME_MS 100
#define CTS_INTERRUPT_TRIGGER_DELAY_US (250 * MSEC)
enum cts_rc {
#include "cts.rc"
};
struct cts_test {
enum cts_rc (*run)(void);
char *name;
};
extern const int cts_test_count;
/**
* Main loop where each test in a suite is executed
*
* A test suite can implement its custom loop as needed.
*
* Args:
* @test: List of tests to run
* @name: Name of the test to be printed on EC console
*/
void cts_main_loop(const struct cts_test* tests, const char *name);
/**
* Callback function called at the beginning of the main loop
*/
void clean_state(void);
/**
* Synchronize DUT and TH
*
* @return CTS_RC_SUCCESS if sync is successful
*/
enum cts_rc sync(void);
#endif