lib: add a define for test failure exit status

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
Thomas Wood 2015-04-09 09:24:12 +01:00
parent 41fe1d1a44
commit b47032e191
6 changed files with 19 additions and 13 deletions

View File

@ -73,7 +73,7 @@ expression list[n] Ep;
@@ @@
@@ @@
-abort(); -abort();
+igt_fail(1); +igt_fail(IGT_EXIT_FAILURE);
@@ @@
iterator name for_each_pipe; iterator name for_each_pipe;

View File

@ -993,8 +993,8 @@ static void print_backtrace(void)
} }
#endif #endif
void __igt_fail_assert(int exitcode, const char *domain, const char *file, void __igt_fail_assert(const char *domain, const char *file, const int line,
const int line, const char *func, const char *assertion, const char *func, const char *assertion,
const char *f, ...) const char *f, ...)
{ {
va_list args; va_list args;
@ -1020,7 +1020,7 @@ void __igt_fail_assert(int exitcode, const char *domain, const char *file,
if (run_under_gdb()) if (run_under_gdb())
abort(); abort();
igt_fail(exitcode); igt_fail(IGT_EXIT_FAILURE);
} }
/** /**

View File

@ -84,6 +84,12 @@ extern const char* __igt_test_description __attribute__((weak));
*/ */
#define IGT_EXIT_INVALID 79 #define IGT_EXIT_INVALID 79
/**
* IGT_EXIT_FAILURE
*
* Exit status indicating a test failure
*/
#define IGT_EXIT_FAILURE 99
bool __igt_fixture(void); bool __igt_fixture(void);
void __igt_fixture_complete(void); void __igt_fixture_complete(void);
@ -250,8 +256,8 @@ void __igt_skip_check(const char *file, const int line,
void igt_success(void); void igt_success(void);
void igt_fail(int exitcode) __attribute__((noreturn)); void igt_fail(int exitcode) __attribute__((noreturn));
__attribute__((format(printf, 7, 8))) __attribute__((format(printf, 6, 7)))
void __igt_fail_assert(int exitcode, const char *domain, const char *file, void __igt_fail_assert(const char *domain, const char *file,
const int line, const char *func, const char *assertion, const int line, const char *func, const char *assertion,
const char *format, ...) const char *format, ...)
__attribute__((noreturn)); __attribute__((noreturn));
@ -267,7 +273,7 @@ void igt_exit(void) __attribute__((noreturn));
*/ */
#define igt_assert(expr) \ #define igt_assert(expr) \
do { if (!(expr)) \ do { if (!(expr)) \
__igt_fail_assert(99, IGT_LOG_DOMAIN, __FILE__, __LINE__, __func__, #expr , NULL); \ __igt_fail_assert(IGT_LOG_DOMAIN, __FILE__, __LINE__, __func__, #expr , NULL); \
} while (0) } while (0)
/** /**
@ -284,7 +290,7 @@ void igt_exit(void) __attribute__((noreturn));
*/ */
#define igt_assert_f(expr, f...) \ #define igt_assert_f(expr, f...) \
do { if (!(expr)) \ do { if (!(expr)) \
__igt_fail_assert(99, IGT_LOG_DOMAIN, __FILE__, __LINE__, __func__, #expr , f); \ __igt_fail_assert(IGT_LOG_DOMAIN, __FILE__, __LINE__, __func__, #expr , f); \
} while (0) } while (0)
/** /**
@ -329,7 +335,7 @@ void igt_exit(void) __attribute__((noreturn));
do { \ do { \
int __n1 = (n1), __n2 = (n2); \ int __n1 = (n1), __n2 = (n2); \
if (__n1 cmp __n2) ; else \ if (__n1 cmp __n2) ; else \
__igt_fail_assert(99, IGT_LOG_DOMAIN, __FILE__, __LINE__, __func__, \ __igt_fail_assert(IGT_LOG_DOMAIN, __FILE__, __LINE__, __func__, \
#n1 " " #cmp " " #n2, \ #n1 " " #cmp " " #n2, \
"error: %d " #ncmp " %d\n", __n1, __n2); \ "error: %d " #ncmp " %d\n", __n1, __n2); \
} while (0) } while (0)
@ -338,7 +344,7 @@ void igt_exit(void) __attribute__((noreturn));
do { \ do { \
uint32_t __n1 = (n1), __n2 = (n2); \ uint32_t __n1 = (n1), __n2 = (n2); \
if (__n1 cmp __n2) ; else \ if (__n1 cmp __n2) ; else \
__igt_fail_assert(99, IGT_LOG_DOMAIN, __FILE__, __LINE__, __func__, \ __igt_fail_assert(IGT_LOG_DOMAIN, __FILE__, __LINE__, __func__, \
#n1 " " #cmp " " #n2, \ #n1 " " #cmp " " #n2, \
"error: %#x " #ncmp " %#x\n", __n1, __n2); \ "error: %#x " #ncmp " %#x\n", __n1, __n2); \
} while (0) } while (0)

View File

@ -377,7 +377,7 @@ intel_blt_copy(struct intel_batchbuffer *batch,
XY_SRC_COPY_BLT_WRITE_RGB; XY_SRC_COPY_BLT_WRITE_RGB;
break; break;
default: default:
igt_fail(1); igt_fail(IGT_EXIT_FAILURE);
} }
BLIT_COPY_BATCH_START(cmd_bits); BLIT_COPY_BATCH_START(cmd_bits);

View File

@ -317,7 +317,7 @@ static void run_test(data_t *data, enum ring r1, enum ring r2, enum test test)
bo_check(data, b, 0xc); bo_check(data, b, 0xc);
break; break;
default: default:
igt_fail(1); igt_fail(IGT_EXIT_FAILURE);
} }
r1_ops->busy_fini(data); r1_ops->busy_fini(data);

View File

@ -100,7 +100,7 @@ static void assert_color(char *crc, enum color color)
(bh & mask) == 0); (bh & mask) == 0);
break; break;
default: default:
igt_fail(-1); igt_fail(IGT_EXIT_FAILURE);
} }
} }