From patchwork Fri Jun 17 14:05:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 9184049 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 72DE46075F for ; Fri, 17 Jun 2016 14:05:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7007E28390 for ; Fri, 17 Jun 2016 14:05:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 649C32839F; Fri, 17 Jun 2016 14:05:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF56D28390 for ; Fri, 17 Jun 2016 14:05:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 002CC6E377; Fri, 17 Jun 2016 14:05:51 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 282EC6E377 for ; Fri, 17 Jun 2016 14:05:49 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id m124so50392wme.3 for ; Fri, 17 Jun 2016 07:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UXopw5UEMd4BPrrOW+qCEzyrDtQlqxEstn15XRxs4yQ=; b=Jizr/SqhPIfU7rIPgzb6hWutxJHhqnI230Ct8tfBVxmMeeE4S1bY4eXkxuzEPsC/3Y 1Fp0amW7fsQKmMesGefdAE6CVjIK2MFaxUGk5ZLVgVv6TkL1Cf/1fnFRlbyo76DU2NZ0 nnR7YJYRQIi5R7lQJIPAhk3k20GDAJriUh2Mw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UXopw5UEMd4BPrrOW+qCEzyrDtQlqxEstn15XRxs4yQ=; b=URU7zV6Sii3xumPqG0HQZGN0aNg2gbnmJZ8iqBbzSqQ3K30wzHJj2DLVpJM1/ias5o VT7wRZCr4+muNk6YIn1iVdMxGVgwUD+XJFr9nOnMYR/3+Dj21QyNcHdbTNIWi+5IrJJ8 Sa+wRL9uPsIneRJHhrcEEvV9W1QSt6SLvr09qPVxn4Lwp++wvzcgOaDAKgeOq57kkDxn 90m0ZpvB8Lbdrq8AtMeVQou5x/ZVTOly44xAV9JWfqcV5Da3C2kGdoLWaaBXc2Jl+RzG C+IRLBmruE1rVzTeADmKN4gPcW6mNoGJ88kc6CFmArc3b4ezQy1w4DVwK+ptUNWblKsj 0grw== X-Gm-Message-State: ALyK8tJ+aVT+L+hYnfSBq1ufiFvt2ZuLX4w7IzDufQS3GzZU8EUyINIfG4AzX3lKM8ymYA== X-Received: by 10.194.236.195 with SMTP id uw3mr2872971wjc.149.1466172347159; Fri, 17 Jun 2016 07:05:47 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:56b5:0:ac27:b86c:7764:9429]) by smtp.gmail.com with ESMTPSA id q189sm20155798wmd.19.2016.06.17.07.05.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jun 2016 07:05:46 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Fri, 17 Jun 2016 16:05:39 +0200 Message-Id: <1466172339-9074-2-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1466172339-9074-1-git-send-email-daniel.vetter@ffwll.ch> References: <1466172339-9074-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Daniel Vetter Subject: [Intel-gfx] [PATCH i-g-t 2/2] tests: Push igt_fork/stop_hang_detector into fixtures 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-Virus-Scanned: ClamAV using ClamSMTP It access hardware, hence why the simple igt_only_list_subtests() check from igt_fork/stop_signal_helper() isn't enough. Signed-off-by: Daniel Vetter --- lib/igt_aux.c | 6 ------ tests/gem_concurrent_all.c | 6 ++++-- tests/gem_ctx_create.c | 10 +++++----- tests/gem_ctx_switch.c | 7 +++---- tests/gem_evict_everything.c | 4 ++-- tests/gem_exec_basic.c | 11 ++++++----- tests/gem_exec_create.c | 10 ++++++---- tests/gem_exec_flush.c | 10 +++++----- tests/gem_exec_gttfill.c | 6 ++---- tests/gem_exec_nop.c | 7 +++---- tests/gem_exec_parallel.c | 11 ++++++----- tests/gem_exec_store.c | 11 ++++++----- tests/gem_exec_suspend.c | 11 ++++++----- tests/gem_exec_whisper.c | 11 ++++++----- tests/gem_sync.c | 11 ++++++----- 15 files changed, 66 insertions(+), 66 deletions(-) diff --git a/lib/igt_aux.c b/lib/igt_aux.c index 27b74aec8461..e64b29cc090e 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -403,9 +403,6 @@ void igt_fork_hang_detector(int fd) { struct stat st; - if (igt_only_list_subtests()) - return; - igt_assert(fstat(fd, &st) == 0); signal(SIGRTMAX, sig_abort); @@ -415,9 +412,6 @@ void igt_fork_hang_detector(int fd) void igt_stop_hang_detector(void) { - if (igt_only_list_subtests()) - return; - igt_stop_helper(&hang_detector); } #else diff --git a/tests/gem_concurrent_all.c b/tests/gem_concurrent_all.c index 019628eda1f8..9b19455bcfd8 100644 --- a/tests/gem_concurrent_all.c +++ b/tests/gem_concurrent_all.c @@ -1432,7 +1432,8 @@ run_mode(const char *prefix, continue; if (!*h->suffix) - igt_fork_hang_detector(fd); + igt_fixture + igt_fork_hang_detector(fd); for (p = all ? pipelines : pskip; p->prefix; p++) { igt_fixture p->require(); @@ -1563,7 +1564,8 @@ run_mode(const char *prefix, } if (!*h->suffix) - igt_stop_hang_detector(); + igt_fixture + igt_stop_hang_detector(); } igt_fixture diff --git a/tests/gem_ctx_create.c b/tests/gem_ctx_create.c index 0bdd4082d37e..021cfa24ff81 100644 --- a/tests/gem_ctx_create.c +++ b/tests/gem_ctx_create.c @@ -160,9 +160,9 @@ igt_main } } else ppgtt_engines[ppgtt_nengine++] = 0; - } - igt_fork_hang_detector(fd); + igt_fork_hang_detector(fd); + } igt_subtest("basic") { memset(&create, 0, sizeof(create)); @@ -193,8 +193,8 @@ igt_main active(fd, e->exec_id | e->flags, 20, ncpus); } - igt_stop_hang_detector(); - - igt_fixture + igt_fixture { + igt_stop_hang_detector(); close(fd); + } } diff --git a/tests/gem_ctx_switch.c b/tests/gem_ctx_switch.c index 7b273368faa8..aa48a1683457 100644 --- a/tests/gem_ctx_switch.c +++ b/tests/gem_ctx_switch.c @@ -152,9 +152,9 @@ igt_main fd = drm_open_driver(DRIVER_INTEL); handle = gem_create(fd, 4096); gem_write(fd, handle, 0, &bbe, sizeof(bbe)); - } - igt_fork_hang_detector(fd); + igt_fork_hang_detector(fd); + } for (e = intel_execution_engines; e->name; e++) { igt_subtest_f("%s%s", e->exec_id == 0 ? "basic-" : "", e->name) @@ -167,9 +167,8 @@ igt_main single(fd, handle, e, INTERRUPTIBLE, ncpus); } - igt_stop_hang_detector(); - igt_fixture { + igt_stop_hang_detector(); gem_close(fd, handle); close(fd); } diff --git a/tests/gem_evict_everything.c b/tests/gem_evict_everything.c index 61ee5479e246..51ed2931dfc5 100644 --- a/tests/gem_evict_everything.c +++ b/tests/gem_evict_everything.c @@ -266,10 +266,10 @@ igt_main test_major_evictions(fd, size, count); } - igt_stop_hang_helper(); + igt_stop_signal_helper(); igt_fixture { - igt_stop_signal_helper(); + igt_stop_hang_helper(); close(fd); } } diff --git a/tests/gem_exec_basic.c b/tests/gem_exec_basic.c index b0a4cda24e85..5f0f33b871a7 100644 --- a/tests/gem_exec_basic.c +++ b/tests/gem_exec_basic.c @@ -104,10 +104,11 @@ igt_main const struct intel_execution_engine *e; int fd = -1; - igt_fixture + igt_fixture { fd = drm_open_driver(DRIVER_INTEL); - igt_fork_hang_detector(fd); + igt_fork_hang_detector(fd); + } for (e = intel_execution_engines; e->name; e++) { igt_subtest_f("basic-%s", e->name) @@ -118,8 +119,8 @@ igt_main gtt(fd, e->exec_id | e->flags); } - igt_stop_hang_detector(); - - igt_fixture + igt_fixture { + igt_stop_hang_detector(); close(fd); + } } diff --git a/tests/gem_exec_create.c b/tests/gem_exec_create.c index f5a61bacf91d..6e01947c57e9 100644 --- a/tests/gem_exec_create.c +++ b/tests/gem_exec_create.c @@ -150,10 +150,11 @@ igt_main const int ncpus = sysconf(_SC_NPROCESSORS_ONLN); int device = -1; - igt_fixture + igt_fixture { device = drm_open_driver(DRIVER_INTEL); - igt_fork_hang_detector(device); + igt_fork_hang_detector(device); + } igt_subtest("basic") all(device, 0, 20, 1); @@ -163,8 +164,9 @@ igt_main igt_subtest("madvise") all(device, LEAK, 20, 1); - igt_stop_hang_detector(); - igt_fixture + igt_fixture { + igt_stop_hang_detector(); close(device); + } } diff --git a/tests/gem_exec_flush.c b/tests/gem_exec_flush.c index e42078955324..c16638b817d9 100644 --- a/tests/gem_exec_flush.c +++ b/tests/gem_exec_flush.c @@ -519,9 +519,9 @@ igt_main gem_require_mmap_wc(fd); gen = intel_gen(intel_get_drm_devid(fd)); igt_info("Has LLC? %s\n", yesno(gem_has_llc(fd))); - } - igt_fork_hang_detector(fd); + igt_fork_hang_detector(fd); + } for (e = intel_execution_engines; e->name; e++) igt_subtest_group { unsigned ring = e->exec_id | e->flags; @@ -593,8 +593,8 @@ igt_main } } - igt_stop_hang_detector(); - - igt_fixture + igt_fixture { + igt_stop_hang_detector(); close(fd); + } } diff --git a/tests/gem_exec_gttfill.c b/tests/gem_exec_gttfill.c index 5966125c7e81..3ec43dcf11f2 100644 --- a/tests/gem_exec_gttfill.c +++ b/tests/gem_exec_gttfill.c @@ -196,10 +196,9 @@ igt_main igt_fixture { device = drm_open_driver(DRIVER_INTEL); + igt_fork_hang_detector(device); } - igt_fork_hang_detector(device); - igt_subtest("basic") fillgtt(device, 0, 1); /* just enough to run a single pass */ @@ -210,9 +209,8 @@ igt_main igt_subtest("all") fillgtt(device, 0, 150); - igt_stop_hang_detector(); - igt_fixture { + igt_stop_hang_detector(); close(device); } } diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c index e90d5ebad023..9e5aab50f022 100644 --- a/tests/gem_exec_nop.c +++ b/tests/gem_exec_nop.c @@ -208,9 +208,9 @@ igt_main device = drm_open_driver(DRIVER_INTEL); handle = gem_create(device, 4096); gem_write(device, handle, 0, &bbe, sizeof(bbe)); - } - igt_fork_hang_detector(device); + igt_fork_hang_detector(device); + } igt_subtest("basic") all(device, handle, 10); @@ -222,9 +222,8 @@ igt_main igt_subtest("all") all(device, handle, 150); - igt_stop_hang_detector(); - igt_fixture { + igt_stop_hang_detector(); gem_close(device, handle); close(device); } diff --git a/tests/gem_exec_parallel.c b/tests/gem_exec_parallel.c index 2c04ca16263a..6532797ad3f6 100644 --- a/tests/gem_exec_parallel.c +++ b/tests/gem_exec_parallel.c @@ -267,10 +267,11 @@ igt_main }; int fd; - igt_fixture + igt_fixture { fd = drm_open_driver_master(DRIVER_INTEL); - igt_fork_hang_detector(fd); + igt_fork_hang_detector(fd); + } for (const struct mode *m = modes; m->name; m++) igt_subtest_f("%s", *m->name ? m->name : "basic") @@ -286,8 +287,8 @@ igt_main all(fd, e->exec_id | e->flags, m->flags); } - igt_stop_hang_detector(); - - igt_fixture + igt_fixture { + igt_stop_hang_detector(); close(fd); + } } diff --git a/tests/gem_exec_store.c b/tests/gem_exec_store.c index ae7524258974..cd852e603329 100644 --- a/tests/gem_exec_store.c +++ b/tests/gem_exec_store.c @@ -213,10 +213,11 @@ igt_main const struct intel_execution_engine *e; int fd; - igt_fixture + igt_fixture { fd = drm_open_driver_master(DRIVER_INTEL); - igt_fork_hang_detector(fd); + igt_fork_hang_detector(fd); + } for (e = intel_execution_engines; e->name; e++) igt_subtest_f("basic-%s", e->name) @@ -225,8 +226,8 @@ igt_main igt_subtest("basic-all") store_all(fd); - igt_stop_hang_detector(); - - igt_fixture + igt_fixture { + igt_stop_hang_detector(); close(fd); + } } diff --git a/tests/gem_exec_suspend.c b/tests/gem_exec_suspend.c index cd133cc5e835..a45082ea2b6b 100644 --- a/tests/gem_exec_suspend.c +++ b/tests/gem_exec_suspend.c @@ -238,10 +238,11 @@ igt_main const struct intel_execution_engine *e; int fd; - igt_fixture + igt_fixture { fd = drm_open_driver_master(DRIVER_INTEL); - igt_fork_hang_detector(fd); + igt_fork_hang_detector(fd); + } igt_subtest("basic") run_test(fd, -1, NOSLEEP); @@ -261,8 +262,8 @@ igt_main } } - igt_stop_hang_detector(); - - igt_fixture + igt_fixture { + igt_stop_hang_detector(); close(fd); + } } diff --git a/tests/gem_exec_whisper.c b/tests/gem_exec_whisper.c index 0b309234c2b8..24c258f6181e 100644 --- a/tests/gem_exec_whisper.c +++ b/tests/gem_exec_whisper.c @@ -390,10 +390,11 @@ igt_main }; int fd; - igt_fixture + igt_fixture { fd = drm_open_driver_master(DRIVER_INTEL); - igt_fork_hang_detector(fd); + igt_fork_hang_detector(fd); + } for (const struct mode *m = modes; m->name; m++) igt_subtest_f("%s", m->name) @@ -410,8 +411,8 @@ igt_main } } - igt_stop_hang_detector(); - - igt_fixture + igt_fixture { + igt_stop_hang_detector(); close(fd); + } } diff --git a/tests/gem_sync.c b/tests/gem_sync.c index 320bce3378e4..937c6eb2c7d6 100644 --- a/tests/gem_sync.c +++ b/tests/gem_sync.c @@ -209,10 +209,11 @@ igt_main igt_skip_on_simulation(); - igt_fixture + igt_fixture { fd = drm_open_driver(DRIVER_INTEL); - igt_fork_hang_detector(fd); + igt_fork_hang_detector(fd); + } for (e = intel_execution_engines; e->name; e++) { igt_subtest_f("%s", e->name) @@ -231,8 +232,8 @@ igt_main igt_subtest("forked-all") sync_all(fd, ncpus); - igt_stop_hang_detector(); - - igt_fixture + igt_fixture { + igt_stop_hang_detector(); close(fd); + } }