[PATCH 06/12] drm/xe/tests: Add helper macro to detect if KUnit is running
Michal Wajdeczko
michal.wajdeczko at intel.com
Fri Aug 9 16:51:53 UTC 2024
In upcoming patch we will add some functionality that will be
used by the KUnit test code but outside of the KUnit context,
while still should be activated only when the KUnit test is
running. Add simple helper to hide implementation details.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
---
drivers/gpu/drm/xe/tests/xe_test.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/xe/tests/xe_test.h b/drivers/gpu/drm/xe/tests/xe_test.h
index 9c23ad9dba8d..b8fa409ce2b1 100644
--- a/drivers/gpu/drm/xe/tests/xe_test.h
+++ b/drivers/gpu/drm/xe/tests/xe_test.h
@@ -31,6 +31,7 @@ struct xe_test_priv {
#define XE_TEST_DECLARE(x) x
#define XE_TEST_ONLY(x) unlikely(x)
+#define XE_TEST_RUNNING() static_branch_unlikely(&kunit_running)
/**
* xe_cur_kunit_priv - Obtain the struct xe_test_priv pointed to by
@@ -57,6 +58,8 @@ xe_cur_kunit_priv(enum xe_test_priv_id id)
#define XE_TEST_DECLARE(x)
#define XE_TEST_ONLY(x) 0
+#define XE_TEST_RUNNING() false
+
#define xe_cur_kunit_priv(_id) NULL
#endif
--
2.43.0
More information about the Intel-xe
mailing list