From: Daniel Vetter Subject: [PATCH 1/2] tests/pc8+: Only skip i2c subtest if i2c /dev interface is unavailable Date: Fri, 4 Oct 2013 19:59:39 +0200 Message-ID: <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-ea0-f171.google.com (mail-ea0-f171.google.com [209.85.215.171]) by gabe.freedesktop.org (Postfix) with ESMTP id 88084E6854 for ; Fri, 4 Oct 2013 10:59:48 -0700 (PDT) Received: by mail-ea0-f171.google.com with SMTP id n15so1975258ead.30 for ; Fri, 04 Oct 2013 10:59:47 -0700 (PDT) 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 Through the magic of igt_skip we only need to fail this subtest, not the entire thing. Signed-off-by: Daniel Vetter --- tests/pc8.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/tests/pc8.c b/tests/pc8.c index 9070a6b..e93d928 100644 --- a/tests/pc8.c +++ b/tests/pc8.c @@ -580,10 +580,6 @@ static bool test_i2c(struct mode_set_data *data) static bool setup_environment(void) { - int i2c_dev_files; - DIR *dev_dir; - struct dirent *dirent; - drm_fd = drm_open_any(); if (drm_fd <= 0) return false; @@ -603,23 +599,6 @@ static bool setup_environment(void) return false; } - /* Make sure the /dev/i2c-* files exist. */ - dev_dir = opendir("/dev"); - if (!dev_dir) { - printf("Can't open /dev.\n"); - return false; - } - i2c_dev_files = 0; - while ((dirent = readdir(dev_dir))) { - if (strncmp(dirent->d_name, "i2c-", 4) == 0) - i2c_dev_files++; - } - closedir(dev_dir); - if (!i2c_dev_files) { - printf("No /dev/i2c-* files.\n"); - return false; - } - /* Non-ULT machines don't support PC8+. */ if (!supports_pc8_plus_residencies()) { printf("Machine doesn't support PC8+ residencies.\n"); @@ -701,7 +680,19 @@ static void batch_subtest(void) /* Try to use raw I2C, which also needs interrupts. */ static void i2c_subtest(void) { - printf("Testing raw i2c protocol calls.\n"); + int i2c_dev_files = 0; + DIR *dev_dir; + struct dirent *dirent; + + /* Make sure the /dev/i2c-* files exist. */ + dev_dir = opendir("/dev"); + igt_assert(dev_dir); + while ((dirent = readdir(dev_dir))) { + if (strncmp(dirent->d_name, "i2c-", 4) == 0) + i2c_dev_files++; + } + closedir(dev_dir); + igt_require(i2c_dev_files); enable_one_screen(&ms_data); igt_assert(pc8_plus_disabled()); -- 1.8.3.2