summaryrefslogtreecommitdiff
path: root/cts/common
diff options
context:
space:
mode:
authorChris Chen <twothreecc@google.com>2016-07-11 14:52:05 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-07-21 13:13:43 -0700
commit3e98dec612af459ef0c457c206e55dbe11b5ecbe (patch)
tree6853e5f42521fad6af8eed98007ad6da16616d54 /cts/common
parent5df351f63cbe3834ae8f2df401f70cd04c99b5fe (diff)
downloadchrome-ec-3e98dec612af459ef0c457c206e55dbe11b5ecbe.tar.gz
cts: Added file to list error codes as integers
BRANCH=None BUG=None TEST=Manual - Connect handshake and gpio test lines between th and dut - Build tests - run 'cat /dev/ttyACM0' in one terminal - run 'cat /def/ttyACM1' in another - Flash boards - All test results print their test name followed by a space and and integer error code Change-Id: If52e9b50705779b3a291e2d0f6b0721a5b6197d8 Reviewed-on: https://chromium-review.googlesource.com/359988 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')
-rw-r--r--cts/common/cts.rc10
-rw-r--r--cts/common/cts_common.h8
-rw-r--r--cts/common/cts_testlist.h2
-rw-r--r--cts/common/dut_common.c4
-rw-r--r--cts/common/dut_common.h2
-rw-r--r--cts/common/th_common.c4
-rw-r--r--cts/common/th_common.h2
7 files changed, 20 insertions, 12 deletions
diff --git a/cts/common/cts.rc b/cts/common/cts.rc
new file mode 100644
index 0000000000..ec9bab76af
--- /dev/null
+++ b/cts/common/cts.rc
@@ -0,0 +1,10 @@
+/* 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.
+ */
+
+/* This file is included by cts_common.h as an enumeration of error codes. */
+CTS_RC_SUCCESS,
+CTS_RC_FAILURE,
+CTS_RC_BAD_SYNC,
+CTS_RC_UNKNOWN
diff --git a/cts/common/cts_common.h b/cts/common/cts_common.h
index 6233740167..cfc347c3c2 100644
--- a/cts/common/cts_common.h
+++ b/cts/common/cts_common.h
@@ -18,11 +18,9 @@
/* In a single test, only one board can return unknown, the other must
* return a useful result (i.e. success, failure, etc)
*/
-enum cts_error_code {
- CTS_SUCCESS,
- CTS_ERROR_FAILURE,
- CTS_ERROR_BAD_SYNC,
- CTS_ERROR_UNKNOWN
+
+enum cts_rc {
+ #include "cts.rc"
};
#endif
diff --git a/cts/common/cts_testlist.h b/cts/common/cts_testlist.h
index 8f560d674d..a9a53c56f6 100644
--- a/cts/common/cts_testlist.h
+++ b/cts/common/cts_testlist.h
@@ -4,7 +4,7 @@
*/
struct cts_test {
- enum cts_error_code (*run)(void);
+ enum cts_rc (*run)(void);
char *name;
};
diff --git a/cts/common/dut_common.c b/cts/common/dut_common.c
index 3c8a64b4da..bae4662fbc 100644
--- a/cts/common/dut_common.c
+++ b/cts/common/dut_common.c
@@ -12,7 +12,7 @@
/* Returns unknown because TH could potentially still get stuck
* even if the DUT completes the sync
*/
-enum cts_error_code sync(void)
+enum cts_rc sync(void)
{
int input_level;
@@ -28,5 +28,5 @@ enum cts_error_code sync(void)
} while (input_level);
gpio_set_level(GPIO_HANDSHAKE_OUTPUT, 0);
- return CTS_ERROR_UNKNOWN;
+ return CTS_RC_UNKNOWN;
}
diff --git a/cts/common/dut_common.h b/cts/common/dut_common.h
index bd844499be..f812631633 100644
--- a/cts/common/dut_common.h
+++ b/cts/common/dut_common.h
@@ -8,6 +8,6 @@
#include "cts_common.h"
-enum cts_error_code sync(void);
+enum cts_rc sync(void);
#endif
diff --git a/cts/common/th_common.c b/cts/common/th_common.c
index d30d5ffe32..bcab367658 100644
--- a/cts/common/th_common.c
+++ b/cts/common/th_common.c
@@ -12,7 +12,7 @@
/* Return SUCCESS if and only if we reach end of function
* Returning success here means sync was successful
*/
-enum cts_error_code sync(void)
+enum cts_rc sync(void)
{
int input_level;
@@ -32,5 +32,5 @@ enum cts_error_code sync(void)
input_level = gpio_get_level(GPIO_HANDSHAKE_INPUT);
} while (input_level);
- return CTS_SUCCESS;
+ return CTS_RC_SUCCESS;
}
diff --git a/cts/common/th_common.h b/cts/common/th_common.h
index 0495e1048e..339375c78c 100644
--- a/cts/common/th_common.h
+++ b/cts/common/th_common.h
@@ -8,6 +8,6 @@
#include "cts_common.h"
-enum cts_error_code sync(void);
+enum cts_rc sync(void);
#endif