summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/common.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h
index bc35a054ae..746b185226 100644
--- a/include/common.h
+++ b/include/common.h
@@ -252,8 +252,18 @@
#define test_mockable __attribute__((weak))
#define test_mockable_static __attribute__((weak))
#define test_mockable_static_inline __attribute__((weak))
+/*
+ * Tests implemented with ztest add mock implementations that actually return,
+ * so they should not be marked "noreturn". See
+ * test/drivers/default/src/panic_output.c.
+ */
+#ifdef CONFIG_ZTEST
#define test_mockable_noreturn __attribute__((weak))
#define test_mockable_static_noreturn __attribute__((weak))
+#else
+#define test_mockable_noreturn noreturn __attribute__((weak))
+#define test_mockable_static_noreturn noreturn __attribute__((weak))
+#endif
#define test_export_static
#else
#define test_mockable