summaryrefslogtreecommitdiff
path: root/cts/common/cts_common.h
diff options
context:
space:
mode:
authorChris Chen <twothreecc@google.com>2016-07-21 16:34:40 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-08-10 15:30:25 -0700
commit67f6964aefccb60eb7e1284da2186cb5d3b3dfbd (patch)
tree301e5312e4b065b7cb7818011025055d8e98e655 /cts/common/cts_common.h
parentc144822368a3b112c4aeaafd24f208e38b650fe9 (diff)
downloadchrome-ec-67f6964aefccb60eb7e1284da2186cb5d3b3dfbd.tar.gz
cts: Debug message support added to cts tests
You can now add debug messages into a cts test and they will be displayed with the test report html page. The macro to use is CTS_DEBUG_PRINTF Adding debug messages can potentially change test results by slowing down the test, so you can choose when compiling a test suite if you want the debug messages present or not by adding --debug as an argument when you call ./cts --build. BRANCH=None BUG=None TEST=Manual - Add a debug statement to a test - Build the test suite with --debug specified - Flash the boards - Run './cts/cts.py -r' - Open /tmp/cts_results/<board_name>/<test_suite>.html to view see your debug message for the test Change-Id: Icad8e0ac5cc905010caa4e7616f81572ce6ac771 Reviewed-on: https://chromium-review.googlesource.com/362475 Commit-Ready: Chris Chen <twothreecc@google.com> Tested-by: Chris Chen <twothreecc@google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'cts/common/cts_common.h')
-rw-r--r--cts/common/cts_common.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/cts/common/cts_common.h b/cts/common/cts_common.h
index cfc347c3c2..e3a47d3e1b 100644
--- a/cts/common/cts_common.h
+++ b/cts/common/cts_common.h
@@ -13,6 +13,20 @@
#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#ifdef CTS_DEBUG
+/* These debug tags should not be changed */
+#define CTS_DEBUG_START "\n[DEBUG]\n"
+#define CTS_DEBUG_END "\n[DEBUG_END]\n"
+
+#define CTS_DEBUG_PRINTF(format, args...) \
+ do { \
+ CPRINTF(CTS_DEBUG_START format CTS_DEBUG_END, ## args); \
+ cflush(); \
+ } while (0)
+#else
+#define CTS_DEBUG_PRINTF(format, args...)
+#endif
+
#define READ_WAIT_TIME_MS 100
/* In a single test, only one board can return unknown, the other must