From patchwork Thu Apr 9 11:14:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 6187531 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AC0099F2E9 for ; Thu, 9 Apr 2015 11:14:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3EC320396 for ; Thu, 9 Apr 2015 11:14:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BD2B920375 for ; Thu, 9 Apr 2015 11:14:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 339686E33F; Thu, 9 Apr 2015 04:14:35 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com [74.125.82.44]) by gabe.freedesktop.org (Postfix) with ESMTP id 7BA846E379 for ; Thu, 9 Apr 2015 04:14:33 -0700 (PDT) Received: by wgso17 with SMTP id o17so4546891wgs.1 for ; Thu, 09 Apr 2015 04:14:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=GKc8QZuXnKJStTXwYHljVDSwD42EnQHoO90s23p3ELA=; b=WUbqMladAW7f/86G2xBSCbKyZefppE/Xd0c0wbky++mQUbNAm123MGcr8TlfkcXFpz SAO2tG5cLTpuljAWRV7WwS15uCC2U5vs2Hht9+SQ3HO3r1HfnJhjUhqF/RyHXsrIHGjI IqhbxRWOK8ousE+ZvEPxfv/sOxGthjmbavTGr40GK+RjJdIa9vcDA/sE9T5V6Opu617d zUD7wTiF4sFILrXXdpNEjrErzwVUM+xULV9Pf6lQMqh5MYbi49L2g2tOOEZyAINpm0lE VAUP2hRe6TDNn+Ao0PNi8lkiNGj0onRnsz7zxXKDeYoPMYl5swT0wxjvgUHirTOHKQM4 zDxw== X-Gm-Message-State: ALoCoQlTDHC9NLffyosFOPjOkLGYAXDEiM24SCu5JHgI6BhFrvzEU4BGSiUInxQOue0DO5kQrygM X-Received: by 10.180.230.226 with SMTP id tb2mr5226658wic.64.1428578072693; Thu, 09 Apr 2015 04:14:32 -0700 (PDT) Received: from pistachio.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id b10sm2259456wiz.9.2015.04.09.04.14.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 04:14:31 -0700 (PDT) From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Thu, 9 Apr 2015 12:14:28 +0100 Message-Id: <1428578069-8698-1-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 2.1.0 Subject: [Intel-gfx] [PATCH i-g-t 1/2] lib: add a define for test failure exit status X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Thomas Wood --- 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); } }