diff --git a/subsys/testsuite/ztest/include/zephyr/ztest_assert.h b/subsys/testsuite/ztest/include/zephyr/ztest_assert.h index 63b782848a8..0773d3abccd 100644 --- a/subsys/testsuite/ztest/include/zephyr/ztest_assert.h +++ b/subsys/testsuite/ztest/include/zephyr/ztest_assert.h @@ -141,6 +141,24 @@ static inline bool z_zassume(bool cond, const char *default_msg, const char *fil } \ } while (0) +/** + * @brief Skip the test, if @a cond is false + * + * You probably don't need to call this macro directly. You should + * instead use zassume_{condition} macros below. + * + * Note that when CONFIG_MULTITHREADING=n macro returns from the function. It's then expected that + * in that case ztest assumes will be used only in the context of the test function. + * + * NOTE: zassume should not be used to replace zassert, the goal of zassume is to skip tests that + * would otherwise fail due to a zassert on some other dependent behavior that is *not* under test, + * thus reducing what could be tens to hundreds of assertion failures to investigate down to a few + * failures only. + * + * @param cond Condition to check + * @param msg Optional, can be NULL. Message to print if @a cond is false. + * @param default_msg Message to print if @a cond is false + */ #define zassume(cond, default_msg, msg, ...) \ do { \ bool _ret = z_zassume(cond, msg ? ("(" default_msg ")") : (default_msg), __FILE__, \