From: Antonio Argenziano <antonio.argenziano@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [Intel-gfx] [PATCH i-g-t] i915/gem_exec_capture: Check the strlen() for an empty file
Date: Tue, 29 Jan 2019 15:38:18 -0800 [thread overview]
Message-ID: <23c5a581-19e6-06cb-cd1a-f3859d0f1ed4@intel.com> (raw)
In-Reply-To: <20190129112403.10756-1-chris@chris-wilson.co.uk>
On 29/01/19 03:24, Chris Wilson wrote:
> igt_sysfs_get() only returns NULL if the open() fails, and a valid
> string otherwise. So if the read() fails with ENODEV (because sysfs
> doesn't provide the driver with an ->open() callback), we return an
> empty string, and "No error captured" otherwise.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109481
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
LGTM.
Reviwed-by: Antonio Argenziano <antonio.argenziano@intel.com>
> ---
> tests/i915/gem_exec_capture.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tests/i915/gem_exec_capture.c b/tests/i915/gem_exec_capture.c
> index eca73ab11..56837dfca 100644
> --- a/tests/i915/gem_exec_capture.c
> +++ b/tests/i915/gem_exec_capture.c
> @@ -519,6 +519,11 @@ static bool has_capture(int fd)
> return async > 0;
> }
>
> +static size_t safer_strlen(const char *s)
> +{
> + return s ? strlen(s) : 0;
> +}
> +
> igt_main
> {
> const struct intel_execution_engine *e;
> @@ -544,7 +549,7 @@ igt_main
>
> dir = igt_sysfs_open(fd, NULL);
> igt_require(igt_sysfs_set(dir, "error", "Begone!"));
> - igt_require(igt_sysfs_get(dir, "error"));
> + igt_require(safer_strlen(igt_sysfs_get(dir, "error")) > 0);
> }
>
> for (e = intel_execution_engines; e->name; e++) {
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
prev parent reply other threads:[~2019-01-29 23:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-29 11:24 [igt-dev] [PATCH i-g-t] i915/gem_exec_capture: Check the strlen() for an empty file Chris Wilson
2019-01-29 11:56 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-01-29 15:17 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-01-29 23:38 ` Antonio Argenziano [this message]
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=23c5a581-19e6-06cb-cd1a-f3859d0f1ed4@intel.com \
--to=antonio.argenziano@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox