summaryrefslogtreecommitdiff
path: root/zephyr
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr')
-rw-r--r--zephyr/Kconfig11
-rw-r--r--zephyr/shim/include/shimmed_task_id.h5
-rw-r--r--zephyr/test/tasks/prj.conf1
-rw-r--r--zephyr/test/tasks/shimmed_test_tasks.h (renamed from zephyr/test/tasks/shimmed_tasks.h)6
4 files changed, 20 insertions, 3 deletions
diff --git a/zephyr/Kconfig b/zephyr/Kconfig
index 4ef4dd3f34..e05d47a688 100644
--- a/zephyr/Kconfig
+++ b/zephyr/Kconfig
@@ -2,6 +2,17 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+if ZTEST
+
+config HAS_TEST_TASKS
+ bool "Whether or not this test includes custom tasks."
+ help
+ This enables custom tasks for tests. When set to 'y', the file
+ "shimmed_test_tasks.h" will be included and is expected to set
+ CROS_EC_TASK_LIST.
+
+endif # ZTEST
+
menuconfig PLATFORM_EC
bool "Enable building code from the platform/ec Zephyr module"
imply PRINTK
diff --git a/zephyr/shim/include/shimmed_task_id.h b/zephyr/shim/include/shimmed_task_id.h
index 2918cad216..fd23ad47de 100644
--- a/zephyr/shim/include/shimmed_task_id.h
+++ b/zephyr/shim/include/shimmed_task_id.h
@@ -37,6 +37,11 @@ typedef uint8_t task_id_t;
COND_CODE_1(HAS_TASK_KEYSCAN, \
(CROS_EC_TASK(KEYSCAN, keyboard_scan_task, 0, \
CONFIG_TASK_KEYSCAN_STACK_SIZE)), ())
+#elif defined(CONFIG_HAS_TEST_TASKS)
+#include "shimmed_test_tasks.h"
+#ifndef CROS_EC_TASK_LIST
+#error "shimmed_test_tasks.h should define CROS_EC_TASK_LIST"
+#endif /* !CROS_EC_TASK_LIST */
#endif /* !CONFIG_ZTEST */
#ifndef CROS_EC_TASK_LIST
diff --git a/zephyr/test/tasks/prj.conf b/zephyr/test/tasks/prj.conf
index 572ee9bb25..d2cdafda60 100644
--- a/zephyr/test/tasks/prj.conf
+++ b/zephyr/test/tasks/prj.conf
@@ -3,4 +3,5 @@
# found in the LICENSE file.
CONFIG_ZTEST=y
+CONFIG_HAS_TEST_TASKS=y
CONFIG_POLL=y
diff --git a/zephyr/test/tasks/shimmed_tasks.h b/zephyr/test/tasks/shimmed_test_tasks.h
index df3f7ceef0..268b452983 100644
--- a/zephyr/test/tasks/shimmed_tasks.h
+++ b/zephyr/test/tasks/shimmed_test_tasks.h
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#ifndef __CROS_EC_SHIMMED_TASKS_H
-#define __CROS_EC_SHIMMED_TASKS_H
+#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
@@ -17,4 +17,4 @@
CROS_EC_TASK(TASK_1, task1_entry, 0, 512) \
CROS_EC_TASK(TASK_2, task2_entry, 0, 512)
-#endif /* __CROS_EC_SHIMMED_TASKS_H */
+#endif /* __CROS_EC_SHIMMED_TEST_TASKS_H */