From: Daniel Vetter Subject: [PATCH 2/2] tests/pc8: Fail harder Date: Fri, 4 Oct 2013 19:59:40 +0200 Message-ID: <1380909580-2823-2-git-send-email-daniel.vetter@ffwll.ch> References: <1380909580-2823-1-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ee0-f45.google.com (mail-ee0-f45.google.com [74.125.83.45]) by gabe.freedesktop.org (Postfix) with ESMTP id 1E0F5E60D6 for ; Fri, 4 Oct 2013 10:59:49 -0700 (PDT) Received: by mail-ee0-f45.google.com with SMTP id c50so1972403eek.32 for ; Fri, 04 Oct 2013 10:59:49 -0700 (PDT) In-Reply-To: <1380909580-2823-1-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Intel Graphics Development Cc: Daniel Vetter List-Id: intel-gfx@lists.freedesktop.org If the test enviroment isn't properly set up we should fail the testcase, since otherwise there's no way to make sure a feature actually works. To cut down on bug triaging time extract the basic test (which was previously used to skip all subtests) into a "basic" subtest. Also fail the test hard if the msr interface isn't available. And switch all other check in setup_enviroment to igt_require. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69838 Signed-off-by: Daniel Vetter --- tests/pc8.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/tests/pc8.c b/tests/pc8.c index e93d928..79c64fc 100644 --- a/tests/pc8.c +++ b/tests/pc8.c @@ -578,49 +578,33 @@ static bool test_i2c(struct mode_set_data *data) return i2c_edids == drm_edids; } -static bool setup_environment(void) +static void setup_environment(void) { drm_fd = drm_open_any(); - if (drm_fd <= 0) - return false; + igt_assert(drm_fd >= 0); init_mode_set_data(&ms_data); /* Only Haswell supports the PC8 feature. */ - if (!IS_HASWELL(ms_data.devid)) { - printf("PC8+ feature only supported on Haswell.\n"); - return false; - } + igt_require(IS_HASWELL(ms_data.devid)); /* Make sure our Kernel supports MSR and the module is loaded. */ msr_fd = open("/dev/cpu/0/msr", O_RDONLY); - if (msr_fd == -1) { - printf("Can't open /dev/cpu/0/msr.\n"); - return false; - } + igt_assert(msr_fd >= 0); /* Non-ULT machines don't support PC8+. */ - if (!supports_pc8_plus_residencies()) { - printf("Machine doesn't support PC8+ residencies.\n"); - return false; - } + igt_require(supports_pc8_plus_residencies()); +} +static void basic_subtest(void) +{ /* Make sure PC8+ residencies move! */ disable_all_screens(&ms_data); - if (!pc8_plus_enabled()) { - printf("Machine is not reaching PC8+ states, please check its " - "configuration.\n"); - return false; - } + igt_assert(pc8_plus_enabled()); /* Make sure PC8+ residencies stop! */ enable_one_screen(&ms_data); - if (!pc8_plus_disabled()) { - printf("PC8+ residency didn't stop with screen enabled.\n"); - return false; - } - - return true; + igt_assert(pc8_plus_disabled()); } static void teardown_environment(void) @@ -758,8 +742,10 @@ int main(int argc, char *argv[]) * PC8+. We don't want bug reports from cases where the machine is just * not properly configured. */ igt_fixture - igt_require(setup_environment()); + setup_environment(); + igt_subtest("basic") + basic_subtest(); igt_subtest("drm-resources-equal") drm_resources_equal_subtest(); igt_subtest("batch") -- 1.8.3.2