* [PATCH i-g-t 1/2] lib: add a define for test failure exit status
@ 2015-04-09 11:14 Thomas Wood
2015-04-09 11:14 ` [PATCH i-g-t 2/2] lib: use test failure status for igt_set_timeout Thomas Wood
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Wood @ 2015-04-09 11:14 UTC (permalink / raw)
To: intel-gfx
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
lib/igt.cocci | 2 +-
lib/igt_core.c | 6 +++---
lib/igt_core.h | 18 ++++++++++++------
lib/intel_batchbuffer.c | 2 +-
tests/gem_ring_sync_copy.c | 2 +-
tests/kms_sink_crc_basic.c | 2 +-
6 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/lib/igt.cocci b/lib/igt.cocci
index 156f0cf..f23b511 100644
--- a/lib/igt.cocci
+++ b/lib/igt.cocci
@@ -73,7 +73,7 @@ expression list[n] Ep;
@@
@@
-abort();
-+igt_fail(1);
++igt_fail(IGT_EXIT_FAILURE);
@@
iterator name for_each_pipe;
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 8d60930..f9e92c9 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -993,8 +993,8 @@ static void print_backtrace(void)
}
#endif
-void __igt_fail_assert(int exitcode, const char *domain, const char *file,
- const int line, const char *func, const char *assertion,
+void __igt_fail_assert(const char *domain, const char *file, const int line,
+ const char *func, const char *assertion,
const char *f, ...)
{
va_list args;
@@ -1020,7 +1020,7 @@ void __igt_fail_assert(int exitcode, const char *domain, const char *file,
if (run_under_gdb())
abort();
- igt_fail(exitcode);
+ igt_fail(IGT_EXIT_FAILURE);
}
/**
diff --git a/lib/igt_core.h b/lib/igt_core.h
index 4e56be8..3a9e582 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -84,6 +84,12 @@ extern const char* __igt_test_description __attribute__((weak));
*/
#define IGT_EXIT_INVALID 79
+/**
+ * IGT_EXIT_FAILURE
+ *
+ * Exit status indicating a test failure
+ */
+#define IGT_EXIT_FAILURE 99
bool __igt_fixture(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_fail(int exitcode) __attribute__((noreturn));
-__attribute__((format(printf, 7, 8)))
-void __igt_fail_assert(int exitcode, const char *domain, const char *file,
+__attribute__((format(printf, 6, 7)))
+void __igt_fail_assert(const char *domain, const char *file,
const int line, const char *func, const char *assertion,
const char *format, ...)
__attribute__((noreturn));
@@ -267,7 +273,7 @@ void igt_exit(void) __attribute__((noreturn));
*/
#define igt_assert(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)
/**
@@ -284,7 +290,7 @@ void igt_exit(void) __attribute__((noreturn));
*/
#define igt_assert_f(expr, f...) \
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)
/**
@@ -329,7 +335,7 @@ void igt_exit(void) __attribute__((noreturn));
do { \
int __n1 = (n1), __n2 = (n2); \
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, \
"error: %d " #ncmp " %d\n", __n1, __n2); \
} while (0)
@@ -338,7 +344,7 @@ void igt_exit(void) __attribute__((noreturn));
do { \
uint32_t __n1 = (n1), __n2 = (n2); \
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, \
"error: %#x " #ncmp " %#x\n", __n1, __n2); \
} while (0)
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index a1b0643..8b68e52 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -377,7 +377,7 @@ intel_blt_copy(struct intel_batchbuffer *batch,
XY_SRC_COPY_BLT_WRITE_RGB;
break;
default:
- igt_fail(1);
+ igt_fail(IGT_EXIT_FAILURE);
}
BLIT_COPY_BATCH_START(cmd_bits);
diff --git a/tests/gem_ring_sync_copy.c b/tests/gem_ring_sync_copy.c
index f5ffddc..13af198 100644
--- a/tests/gem_ring_sync_copy.c
+++ b/tests/gem_ring_sync_copy.c
@@ -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);
break;
default:
- igt_fail(1);
+ igt_fail(IGT_EXIT_FAILURE);
}
r1_ops->busy_fini(data);
diff --git a/tests/kms_sink_crc_basic.c b/tests/kms_sink_crc_basic.c
index d2cc7ed..e460404 100644
--- a/tests/kms_sink_crc_basic.c
+++ b/tests/kms_sink_crc_basic.c
@@ -100,7 +100,7 @@ static void assert_color(char *crc, enum color color)
(bh & mask) == 0);
break;
default:
- igt_fail(-1);
+ igt_fail(IGT_EXIT_FAILURE);
}
}
--
2.1.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH i-g-t 2/2] lib: use test failure status for igt_set_timeout
2015-04-09 11:14 [PATCH i-g-t 1/2] lib: add a define for test failure exit status Thomas Wood
@ 2015-04-09 11:14 ` Thomas Wood
2015-04-09 12:27 ` Daniel Vetter
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Wood @ 2015-04-09 11:14 UTC (permalink / raw)
To: intel-gfx
Use a failure status code for timeout to avoid confusion between tests
that take too long to execute versus a failure due to an operation
taking longer than expected.
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
lib/igt_core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index f9e92c9..e5bda86 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1705,15 +1705,15 @@ out:
static void igt_alarm_handler(int signal)
{
- /* exit with timeout status */
- igt_fail(IGT_EXIT_TIMEOUT);
+ /* exit with failure status */
+ igt_fail(IGT_EXIT_FAILURE);
}
/**
* igt_set_timeout:
* @seconds: number of seconds before timeout
*
- * Fail a test and exit with #IGT_EXIT_TIMEOUT status after the specified
+ * Fail a test and exit with #IGT_EXIT_FAILURE status after the specified
* number of seconds have elapsed. If the current test has subtests and the
* timeout occurs outside a subtest, subsequent subtests will be skipped and
* marked as failed.
--
2.1.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH i-g-t 2/2] lib: use test failure status for igt_set_timeout
2015-04-09 11:14 ` [PATCH i-g-t 2/2] lib: use test failure status for igt_set_timeout Thomas Wood
@ 2015-04-09 12:27 ` Daniel Vetter
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2015-04-09 12:27 UTC (permalink / raw)
To: Thomas Wood; +Cc: intel-gfx
On Thu, Apr 09, 2015 at 12:14:29PM +0100, Thomas Wood wrote:
> Use a failure status code for timeout to avoid confusion between tests
> that take too long to execute versus a failure due to an operation
> taking longer than expected.
>
> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
> ---
> lib/igt_core.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index f9e92c9..e5bda86 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -1705,15 +1705,15 @@ out:
>
> static void igt_alarm_handler(int signal)
> {
> - /* exit with timeout status */
> - igt_fail(IGT_EXIT_TIMEOUT);
> + /* exit with failure status */
> + igt_fail(IGT_EXIT_FAILURE);
I think an igt_info("timed out\n"); right above might be useful. lgtm
otherwise for both patches.
-Daniel
> }
>
> /**
> * igt_set_timeout:
> * @seconds: number of seconds before timeout
> *
> - * Fail a test and exit with #IGT_EXIT_TIMEOUT status after the specified
> + * Fail a test and exit with #IGT_EXIT_FAILURE status after the specified
> * number of seconds have elapsed. If the current test has subtests and the
> * timeout occurs outside a subtest, subsequent subtests will be skipped and
> * marked as failed.
> --
> 2.1.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-09 12:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-09 11:14 [PATCH i-g-t 1/2] lib: add a define for test failure exit status Thomas Wood
2015-04-09 11:14 ` [PATCH i-g-t 2/2] lib: use test failure status for igt_set_timeout Thomas Wood
2015-04-09 12:27 ` Daniel Vetter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.