From mboxrd@z Thu Jan 1 00:00:00 1970 From: Damien Lespiau Subject: Re: [PATCH v2] igt/gem_workarounds: rework igt to test workaround registers Date: Tue, 2 Sep 2014 10:59:06 +0100 Message-ID: <20140902095906.GJ1118@strange.amr.corp.intel.com> References: <1409578187-2909-3-git-send-email-arun.siluvery@linux.intel.com> <1409649500-12327-1-git-send-email-arun.siluvery@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B56E6E437 for ; Tue, 2 Sep 2014 02:59:12 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1409649500-12327-1-git-send-email-arun.siluvery@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Arun Siluvery Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Tue, Sep 02, 2014 at 10:18:20AM +0100, Arun Siluvery wrote: > - igt_assert(fd >= 0); > + if (fd < 0) > + igt_skip_on("No Workaround table available !!\n"); That's not quite a correct use of the API. The _on is there to signal the first argument is an expression. This will work only because the string is evaluated to true. You probably want to use igt_skip_on_f() http://people.freedesktop.org/~danvet/igt/intel-gpu-tools-i-g-t-core.html#igt-skip-on-f > file = fdopen(fd, "r"); > igt_assert(file > 0); > @@ -193,32 +186,40 @@ igt_main > ret = getline(&line, &line_size, file); > igt_assert(ret > 0); > sscanf(line, "Workarounds applied: %d", &num_wa_regs); > - igt_assert(num_wa_regs > 0); > > - wa_regs = malloc(num_wa_regs * sizeof(*wa_regs)); > + if (num_wa_regs) { > + int i = 0; > > - i = 0; > - while(getline(&line, &line_size, file) > 0) { > - sscanf(line, "0x%X: 0x%08X, mask: 0x%08X", > - &wa_regs[i].addr, &wa_regs[i].value, > - &wa_regs[i].mask); > - ++i; > - } > + wa_regs = malloc(num_wa_regs * sizeof(*wa_regs)); > + while (getline(&line, &line_size, file) > 0) { > + sscanf(line, "0x%X: 0x%08X, mask: 0x%08X", > + &wa_regs[i].addr, &wa_regs[i].value, > + &wa_regs[i].mask); > + ++i; > + } > + } else > + igt_info("No workarounds exported\n"); It's a bit weird to just have an igt_info() here and skip in every single subtest after that. How about a: igt_skip_on_f(num_wa_regs == 0, "No workarounds exported\n"); and continue the rest of the test with the case (num_wa_regs == 0) out of the picture? -- Damien