summaryrefslogtreecommitdiff
path: root/zephyr/test/tasks/shimmed_test_tasks.h
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2020-12-26 20:13:00 -0700
committerCommit Bot <commit-bot@chromium.org>2020-12-28 17:17:25 +0000
commit7cf197d455b3afc565f03abf0b911fd4a208a52e (patch)
tree0ea7e549efec7989279b6268f8256e63cfab76b7 /zephyr/test/tasks/shimmed_test_tasks.h
parent51d7054e1bf0f1e5c5036eba09872033b1a14fa3 (diff)
downloadchrome-ec-7cf197d455b3afc565f03abf0b911fd4a208a52e.tar.gz
zephyr: tasks: Fix collision of shimmed_tasks.h
The issue here was initially found in https://crrev.com/c/2602440 where it was difficult (also not guaranteed to work) to declare custom tasks for tests. The issue was that in zephyr/test/tasks/ the file shimmed_tasks.h was used which is intended to replace zephyr/shim/include/shimmed_tasks.h. So far we've been lucky in that the build was resolving this to the test instance, but this is not guaranteed. This change does the following: 1. If running CONFIG_ZTEST then we add a new CONFIG_HAS_TEST_TASKS option that is defaulted to 'n'. 2. If CONFIG_HAS_TEST_TASKS is set to 'y', then we'll try to include shimmed_test_tasks.h which should be defined by the test and added somewhere in the include path (see zephyr/test/tasks/ for example). 3. We can now define custom tasks for tests. Note that in zephyr we can just use normal tasks via CROS_EC_TASK and don't need to use a special macro for test tasks. BRANCH=none BUG=b:172240633 TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ib99c8ec08923a7e958e045d45d1aa2ec5e841ed5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2603458 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
Diffstat (limited to 'zephyr/test/tasks/shimmed_test_tasks.h')
-rw-r--r--zephyr/test/tasks/shimmed_test_tasks.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/zephyr/test/tasks/shimmed_test_tasks.h b/zephyr/test/tasks/shimmed_test_tasks.h
new file mode 100644
index 0000000000..268b452983
--- /dev/null
+++ b/zephyr/test/tasks/shimmed_test_tasks.h
@@ -0,0 +1,20 @@
+/* Copyright 2020 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 __CROS_EC_SHIMMED_TEST_TASKS_H
+#define __CROS_EC_SHIMMED_TEST_TASKS_H
+
+/*
+ * Manually define these HAS_TASK_* defines. There is a build time assert
+ * to at least verify we have the minimum set defined correctly. */
+#define HAS_TASK_TASK_1 1
+#define HAS_TASK_TASK_2 1
+
+/* Highest priority on bottom same as in platform/ec */
+#define CROS_EC_TASK_LIST \
+ CROS_EC_TASK(TASK_1, task1_entry, 0, 512) \
+ CROS_EC_TASK(TASK_2, task2_entry, 0, 512)
+
+#endif /* __CROS_EC_SHIMMED_TEST_TASKS_H */