All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Lespiau <damien.lespiau@intel.com>
To: Arun Siluvery <arun.siluvery@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2] igt/gem_workarounds: rework igt to test workaround registers
Date: Tue, 2 Sep 2014 10:59:06 +0100	[thread overview]
Message-ID: <20140902095906.GJ1118@strange.amr.corp.intel.com> (raw)
In-Reply-To: <1409649500-12327-1-git-send-email-arun.siluvery@linux.intel.com>

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

  reply	other threads:[~2014-09-02  9:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-01 13:29 [PATCH 0/2] Rework workaround igt Arun Siluvery
2014-09-01 13:29 ` [PATCH 1/2] gem_workarounds: intel_wa_registers is now prefixed with i915 Arun Siluvery
2014-09-01 13:29 ` [PATCH 2/2] igt/gem_workarounds: rework igt to test workaround registers Arun Siluvery
2014-09-01 14:12   ` Damien Lespiau
2014-09-02  9:18   ` [PATCH v2] " Arun Siluvery
2014-09-02  9:59     ` Damien Lespiau [this message]
2014-09-02 11:04       ` Daniel Vetter
2014-09-02 11:12         ` Chris Wilson
2014-09-02 13:22           ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140902095906.GJ1118@strange.amr.corp.intel.com \
    --to=damien.lespiau@intel.com \
    --cc=arun.siluvery@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.