summaryrefslogtreecommitdiff
path: root/cts/common/cts_testlist.h
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2016-07-12 14:32:38 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-07-15 21:39:18 -0700
commitb783f0b991c43310675ab542c95902b65fffdbc4 (patch)
treee83e2500311225a1524dce9ba019bcfd41e00c47 /cts/common/cts_testlist.h
parent846741eddbb28e6770532ab09fb64dc619c2f6e6 (diff)
downloadchrome-ec-b783f0b991c43310675ab542c95902b65fffdbc4.tar.gz
cts: Use pointers for test functions
Test functions are listed in cts.testlist and shared by th.c and dut.c. This way, we can gurantee the two files are in sync. Also, cts.testlist is used to count the number of tests automatically. This allows us to use a for loop to execute each test. BUG=none BRANCH=none TEST=build buildall Change-Id: I0c811405134fad04f5c6914b1ac38835e212cbd2 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359619
Diffstat (limited to 'cts/common/cts_testlist.h')
-rw-r--r--cts/common/cts_testlist.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/cts/common/cts_testlist.h b/cts/common/cts_testlist.h
new file mode 100644
index 0000000000..8f560d674d
--- /dev/null
+++ b/cts/common/cts_testlist.h
@@ -0,0 +1,21 @@
+/* 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.
+ */
+
+struct cts_test {
+ enum cts_error_code (*run)(void);
+ char *name;
+};
+
+#define CTS_TEST(test) {test, STRINGIFY(test)},
+struct cts_test tests[] = {
+#include "cts.testlist"
+};
+
+#undef CTS_TEST
+#define CTS_TEST(test) CTS_TEST_ID_##test,
+enum {
+#include "cts.testlist"
+ CTS_TEST_ID_COUNT,
+};