From patchwork Fri Jun 27 14:15:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tim.gore@intel.com X-Patchwork-Id: 4435681 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D4560BEEAA for ; Fri, 27 Jun 2014 14:16:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE3F2200EC for ; Fri, 27 Jun 2014 14:16:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 768AC200CA for ; Fri, 27 Jun 2014 14:16:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1ABAB6E768; Fri, 27 Jun 2014 07:16:18 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E26C6E768 for ; Fri, 27 Jun 2014 07:16:17 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 27 Jun 2014 07:16:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,560,1400050800"; d="scan'208";a="535077550" Received: from tgore-linux.iwi.intel.com ([172.28.253.145]) by orsmga001.jf.intel.com with ESMTP; 27 Jun 2014 07:15:40 -0700 From: tim.gore@intel.com To: intel-gfx@lists.freedesktop.org Date: Fri, 27 Jun 2014 15:15:36 +0100 Message-Id: <1403878537-29020-2-git-send-email-tim.gore@intel.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1403878537-29020-1-git-send-email-tim.gore@intel.com> References: <1403878537-29020-1-git-send-email-tim.gore@intel.com> Subject: [Intel-gfx] [PATCH 1/2] intel-gpu-tools: pass argc/argv to simple main X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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 From: Tim Gore Quite a few single tests do not use the igt_simple_main macro because they want access to argc/argv. So change the igt_simple_main macro to pass these arguments through to the "__real_mainxxx" function, and change these tests to use the macro. Signed-off-by: Tim Gore --- lib/igt_core.h | 8 ++++---- tests/gem_ctx_basic.c | 6 +----- tests/gem_exec_blt.c | 5 +---- tests/gem_gtt_speed.c | 5 +---- tests/gem_hang.c | 5 +---- tests/gem_render_copy.c | 4 +--- tests/gem_render_linear_blits.c | 5 +---- tests/gem_render_tiled_blits.c | 5 +---- tests/gem_seqno_wrap.c | 11 ++++------- tests/gem_stress.c | 5 +---- tests/gen3_mixed_blits.c | 5 +---- tests/gen3_render_linear_blits.c | 5 +---- tests/gen3_render_mixed_blits.c | 5 +---- tests/gen3_render_tiledx_blits.c | 5 +---- tests/gen3_render_tiledy_blits.c | 5 +---- 15 files changed, 21 insertions(+), 63 deletions(-) diff --git a/lib/igt_core.h b/lib/igt_core.h index e252eba..9853e6b 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -176,13 +176,13 @@ void igt_simple_init(void); * the test needs to parse additional cmdline arguments of its own. */ #define igt_simple_main \ - static void igt_tokencat(__real_main, __LINE__)(void); \ + static void igt_tokencat(__real_main, __LINE__)(int argc, char **argv); \ int main(int argc, char **argv) { \ igt_simple_init(); \ - igt_tokencat(__real_main, __LINE__)(); \ - exit(0); \ + igt_tokencat(__real_main, __LINE__)(argc, argv); \ + igt_exit(); \ } \ - static void igt_tokencat(__real_main, __LINE__)(void) \ + static void igt_tokencat(__real_main, __LINE__)(int argc, char **argv) \ __attribute__((format(printf, 1, 2))) void igt_skip(const char *f, ...) __attribute__((noreturn)); diff --git a/tests/gem_ctx_basic.c b/tests/gem_ctx_basic.c index 3e9b688..fe770ea 100644 --- a/tests/gem_ctx_basic.c +++ b/tests/gem_ctx_basic.c @@ -145,12 +145,10 @@ static void parse(int argc, char *argv[]) } } -int main(int argc, char *argv[]) +igt_simple_main { int i; - igt_simple_init(); - fd = drm_open_any_render(); devid = intel_get_drm_devid(fd); @@ -173,6 +171,4 @@ int main(int argc, char *argv[]) free(threads); close(fd); - - return 0; } diff --git a/tests/gem_exec_blt.c b/tests/gem_exec_blt.c index 3bcef18..3d092fe 100644 --- a/tests/gem_exec_blt.c +++ b/tests/gem_exec_blt.c @@ -253,12 +253,10 @@ static void run(int object_size) close(fd); } -int main(int argc, char **argv) +igt_simple_main { int i; - igt_simple_init(); - igt_skip_on_simulation(); if (argc > 1) { @@ -270,5 +268,4 @@ int main(int argc, char **argv) } else run(OBJECT_SIZE); - return 0; } diff --git a/tests/gem_gtt_speed.c b/tests/gem_gtt_speed.c index 385eeb7..fa20de0 100644 --- a/tests/gem_gtt_speed.c +++ b/tests/gem_gtt_speed.c @@ -50,7 +50,7 @@ static double elapsed(const struct timeval *start, return (1e6*(end->tv_sec - start->tv_sec) + (end->tv_usec - start->tv_usec))/loop; } -int main(int argc, char **argv) +igt_simple_main { struct timeval start, end; uint8_t *buf; @@ -59,8 +59,6 @@ int main(int argc, char **argv) int loop, i, tiling; int fd; - igt_simple_init(); - igt_skip_on_simulation(); if (argc > 1) @@ -329,5 +327,4 @@ int main(int argc, char **argv) gem_close(fd, handle); close(fd); - return 0; } diff --git a/tests/gem_hang.c b/tests/gem_hang.c index 6248244..a4f4d10 100644 --- a/tests/gem_hang.c +++ b/tests/gem_hang.c @@ -68,12 +68,10 @@ gpu_hang(void) intel_batchbuffer_flush(batch); } -int main(int argc, char **argv) +igt_simple_main { int fd; - igt_simple_init(); - igt_assert_f(argc == 2, "usage: %s \n", argv[0]); @@ -93,5 +91,4 @@ int main(int argc, char **argv) close(fd); - return 0; } diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c index fd26b43..12dd90d 100644 --- a/tests/gem_render_copy.c +++ b/tests/gem_render_copy.c @@ -117,7 +117,7 @@ scratch_buf_check(data_t *data, struct igt_buf *buf, int x, int y, color, val, x, y); } -int main(int argc, char **argv) +igt_simple_main { data_t data = {0, }; struct intel_batchbuffer *batch = NULL; @@ -127,7 +127,6 @@ int main(int argc, char **argv) int opt_dump_png = false; int opt_dump_aub = igt_aub_dump_enabled(); - igt_simple_init(); while ((opt = getopt(argc, argv, "d")) != -1) { switch (opt) { @@ -189,5 +188,4 @@ int main(int argc, char **argv) scratch_buf_check(&data, &dst, WIDTH - 10, HEIGHT - 10, SRC_COLOR); } - return 0; } diff --git a/tests/gem_render_linear_blits.c b/tests/gem_render_linear_blits.c index f847486..7c6081e 100644 --- a/tests/gem_render_linear_blits.c +++ b/tests/gem_render_linear_blits.c @@ -81,7 +81,7 @@ check_bo(int fd, uint32_t handle, uint32_t val) } } -int main(int argc, char **argv) +igt_simple_main { drm_intel_bufmgr *bufmgr; struct intel_batchbuffer *batch; @@ -90,8 +90,6 @@ int main(int argc, char **argv) uint32_t start = 0; int i, j, fd, count; - igt_simple_init(); - fd = drm_open_any(); render_copy = igt_get_render_copyfunc(intel_get_drm_devid(fd)); @@ -201,5 +199,4 @@ int main(int argc, char **argv) for (i = 0; i < count; i++) check_bo(fd, bo[i]->handle, start_val[i]); - return 0; } diff --git a/tests/gem_render_tiled_blits.c b/tests/gem_render_tiled_blits.c index f63c57e..ec8e8de 100644 --- a/tests/gem_render_tiled_blits.c +++ b/tests/gem_render_tiled_blits.c @@ -95,7 +95,7 @@ check_bo(struct intel_batchbuffer *batch, struct igt_buf *buf, uint32_t val) dri_bo_unmap(linear); } -int main(int argc, char **argv) +igt_simple_main { drm_intel_bufmgr *bufmgr; struct intel_batchbuffer *batch; @@ -105,8 +105,6 @@ int main(int argc, char **argv) int i, j, fd, count; uint32_t devid; - igt_simple_init(); - igt_skip_on_simulation(); fd = drm_open_any(); @@ -212,5 +210,4 @@ int main(int argc, char **argv) for (i = 0; i < count; i++) check_bo(batch, &buf[i], start_val[i]); - return 0; } diff --git a/tests/gem_seqno_wrap.c b/tests/gem_seqno_wrap.c index beda28b..8a54c2e 100644 --- a/tests/gem_seqno_wrap.c +++ b/tests/gem_seqno_wrap.c @@ -533,12 +533,9 @@ static void parse_options(int argc, char **argv) } } -int main(int argc, char **argv) +igt_simple_main { int wcount = 0; - int r = -1; - - igt_simple_init(); parse_options(argc, argv); @@ -563,8 +560,8 @@ int main(int argc, char **argv) if (options.rounds == wcount) { igt_debug("done %d wraps successfully\n", wcount); - return 0; } - - return r; + else { + igt_fail(-1); + } } diff --git a/tests/gem_stress.c b/tests/gem_stress.c index 2ccb6fc..35ed32f 100644 --- a/tests/gem_stress.c +++ b/tests/gem_stress.c @@ -860,13 +860,11 @@ static void check_render_copyfunc(void) } -int main(int argc, char **argv) +igt_simple_main { int i, j; unsigned *current_permutation, *tmp_permutation; - igt_simple_init(); - drm_fd = drm_open_any(); devid = intel_get_drm_devid(drm_fd); @@ -925,5 +923,4 @@ int main(int argc, char **argv) igt_stop_signal_helper(); - return 0; } diff --git a/tests/gen3_mixed_blits.c b/tests/gen3_mixed_blits.c index 75d61a5..f0a6b64 100644 --- a/tests/gen3_mixed_blits.c +++ b/tests/gen3_mixed_blits.c @@ -457,14 +457,12 @@ check_bo(int fd, uint32_t handle, uint32_t val) munmap(v, WIDTH*HEIGHT*4); } -int main(int argc, char **argv) +igt_simple_main { uint32_t *handle, *tiling, *start_val; uint32_t start = 0; int i, fd, count; - igt_simple_init(); - fd = drm_open_any(); igt_require(IS_GEN3(intel_get_drm_devid(fd))); @@ -533,5 +531,4 @@ int main(int argc, char **argv) check_bo(fd, handle[i], start_val[i]); igt_info("done\n"); - return 0; } diff --git a/tests/gen3_render_linear_blits.c b/tests/gen3_render_linear_blits.c index 7fe368d..60c0d0b 100644 --- a/tests/gen3_render_linear_blits.c +++ b/tests/gen3_render_linear_blits.c @@ -325,14 +325,12 @@ check_bo(int fd, uint32_t handle, uint32_t val) } } -int main(int argc, char **argv) +igt_simple_main { uint32_t *handle, *start_val; uint32_t start = 0; int i, fd, count; - igt_simple_init(); - fd = drm_open_any(); igt_require(IS_GEN3(intel_get_drm_devid(fd))); @@ -393,5 +391,4 @@ int main(int argc, char **argv) for (i = 0; i < count; i++) check_bo(fd, handle[i], start_val[i]); - return 0; } diff --git a/tests/gen3_render_mixed_blits.c b/tests/gen3_render_mixed_blits.c index 77ac0e2..68660a3 100644 --- a/tests/gen3_render_mixed_blits.c +++ b/tests/gen3_render_mixed_blits.c @@ -345,14 +345,12 @@ check_bo(int fd, uint32_t handle, uint32_t val) munmap(v, WIDTH*HEIGHT*4); } -int main(int argc, char **argv) +igt_simple_main { uint32_t *handle, *tiling, *start_val; uint32_t start = 0; int i, fd, count; - igt_simple_init(); - fd = drm_open_any(); igt_require(IS_GEN3(intel_get_drm_devid(fd))); @@ -421,5 +419,4 @@ int main(int argc, char **argv) check_bo(fd, handle[i], start_val[i]); igt_info("done\n"); - return 0; } diff --git a/tests/gen3_render_tiledx_blits.c b/tests/gen3_render_tiledx_blits.c index 95c0c96..d54d714 100644 --- a/tests/gen3_render_tiledx_blits.c +++ b/tests/gen3_render_tiledx_blits.c @@ -332,14 +332,12 @@ check_bo(int fd, uint32_t handle, uint32_t val) munmap(v, WIDTH*HEIGHT*4); } -int main(int argc, char **argv) +igt_simple_main { uint32_t *handle, *start_val; uint32_t start = 0; int i, fd, count; - igt_simple_init(); - fd = drm_open_any(); igt_require(IS_GEN3(intel_get_drm_devid(fd))); @@ -400,5 +398,4 @@ int main(int argc, char **argv) for (i = 0; i < count; i++) check_bo(fd, handle[i], start_val[i]); - return 0; } diff --git a/tests/gen3_render_tiledy_blits.c b/tests/gen3_render_tiledy_blits.c index 1b9a419..3ef08c8 100644 --- a/tests/gen3_render_tiledy_blits.c +++ b/tests/gen3_render_tiledy_blits.c @@ -332,14 +332,12 @@ check_bo(int fd, uint32_t handle, uint32_t val) munmap(v, WIDTH*HEIGHT*4); } -int main(int argc, char **argv) +igt_simple_main { uint32_t *handle, *start_val; uint32_t start = 0; int i, fd, count; - igt_simple_init(); - fd = drm_open_any(); igt_require(IS_GEN3(intel_get_drm_devid(fd))); @@ -407,5 +405,4 @@ int main(int argc, char **argv) check_bo(fd, handle[i], start_val[i]); igt_info("done\n"); - return 0; }