anv/tests: Propagate failures to gtest
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24355>
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
|
|
||||||
#define ANV_C_TEST(S, N, C) extern "C" void C(void); TEST(S, N) { C(); }
|
#define ANV_C_TEST(S, N, C) extern "C" void C(void); TEST(S, N) { C(); }
|
||||||
|
|
||||||
ANV_C_TEST(StatePool, Regular, state_pool_test);
|
ANV_C_TEST(StatePool, Regular, state_pool_test);
|
||||||
@@ -14,3 +16,7 @@ ANV_C_TEST(StatePool, Padding, state_pool_padding_test);
|
|||||||
|
|
||||||
ANV_C_TEST(BlockPool, NoFree, block_pool_no_free_test);
|
ANV_C_TEST(BlockPool, NoFree, block_pool_no_free_test);
|
||||||
ANV_C_TEST(BlockPool, GrowFirst, block_pool_grow_first_test);
|
ANV_C_TEST(BlockPool, GrowFirst, block_pool_grow_first_test);
|
||||||
|
|
||||||
|
extern "C" void FAIL_IN_GTEST(const char *file_path, unsigned line_number, const char *msg) {
|
||||||
|
GTEST_FAIL_AT(file_path, line_number) << msg;
|
||||||
|
}
|
||||||
|
@@ -21,19 +21,27 @@
|
|||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "dev/intel_device_info.h"
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#define ASSERT(cond) \
|
#ifdef __cplusplus
|
||||||
do { \
|
extern "C" {
|
||||||
if (!(cond)) { \
|
#endif
|
||||||
fprintf(stderr, "%s:%d: Test assertion `%s` failed.\n", \
|
|
||||||
__FILE__, __LINE__, # cond); \
|
#define ASSERT(cond) \
|
||||||
abort(); \
|
do { \
|
||||||
} \
|
if (!(cond)) { \
|
||||||
|
FAIL_IN_GTEST(__FILE__, __LINE__, "Test assertion `" # cond \
|
||||||
|
"` failed."); \
|
||||||
|
} \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
static inline void test_device_info_init(struct intel_device_info *info)
|
static inline void test_device_info_init(struct intel_device_info *info)
|
||||||
{
|
{
|
||||||
info->mem_alignment = 4096;
|
info->mem_alignment = 4096;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FAIL_IN_GTEST(const char *file_path, unsigned line_number, const char *msg);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
|
Reference in New Issue
Block a user