mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 18:40:13 +01:00
hasvk/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:
parent
27a66f70a5
commit
58c7ad6ace
2 changed files with 23 additions and 9 deletions
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "test_common.h"
|
||||
|
||||
#define HASVK_C_TEST(S, N, C) extern "C" void C(void); TEST(S, N) { C(); }
|
||||
|
||||
HASVK_C_TEST(StatePool, Regular, state_pool_test);
|
||||
|
|
@ -14,3 +16,7 @@ HASVK_C_TEST(StatePool, Padding, state_pool_padding_test);
|
|||
|
||||
HASVK_C_TEST(BlockPool, NoFree, block_pool_no_free_test);
|
||||
HASVK_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,14 +21,22 @@
|
|||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "dev/intel_device_info.h"
|
||||
|
||||
#define ASSERT(cond) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
fprintf(stderr, "%s:%d: Test assertion `%s` failed.\n", \
|
||||
__FILE__, __LINE__, # cond); \
|
||||
abort(); \
|
||||
} \
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ASSERT(cond) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
FAIL_IN_GTEST(__FILE__, __LINE__, "Test assertion `" # cond \
|
||||
"` failed."); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
void FAIL_IN_GTEST(const char *file_path, unsigned line_number, const char *msg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue