Mesa (main): pan/bi: Add BIT_ASSERT helper for unit testing

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 28 22:36:05 UTC 2021


Module: Mesa
Branch: main
Commit: ca36943466b3422c66964467d27f8f1e6994a382
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca36943466b3422c66964467d27f8f1e6994a382

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Wed Jul 28 12:25:39 2021 -0400

pan/bi: Add BIT_ASSERT helper for unit testing

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12109>

---

 src/panfrost/bifrost/bi_test.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/panfrost/bifrost/bi_test.h b/src/panfrost/bifrost/bi_test.h
index e4df7a2884c..4d93eeafd0c 100644
--- a/src/panfrost/bifrost/bi_test.h
+++ b/src/panfrost/bifrost/bi_test.h
@@ -84,4 +84,13 @@ bit_instr_equal(bi_instr *A, bi_instr *B)
    } \
 } while(0)
 
+#define BIT_ASSERT(condition) do { \
+   if (condition) { \
+      nr_pass++; \
+   } else { \
+      fprintf(stderr, "Assertion failed: %s\n", #condition); \
+      nr_fail++; \
+   } \
+} while(0)
+
 #endif



More information about the mesa-commit mailing list