From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] igt/pm_backlight: Make the actual_brightness test readable
Date: Fri, 7 Sep 2018 17:39:02 +0300 [thread overview]
Message-ID: <20180907143902.GG5565@intel.com> (raw)
In-Reply-To: <20180907081250.5848-1-chris@chris-wilson.co.uk>
On Fri, Sep 07, 2018 at 09:12:50AM +0100, Chris Wilson wrote:
> Previous horror
>
> (pm_backlight:2947) CRITICAL: Test assertion failure function test_and_verify, file ../tests/pm_backlight.c:112:
> (pm_backlight:2947) CRITICAL: Failed assertion: ({ typeof(0) _a = (0); typeof(val - tolerance) _b = (val - tolerance); _a > _b ? _a : _b; }) <= result
> (pm_backlight:2947) CRITICAL: error: 7125 > 0
>
> References: https://bugs.freedesktop.org/show_bug.cgi?id=107847
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> tests/pm_backlight.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/tests/pm_backlight.c b/tests/pm_backlight.c
> index e94340a2b..32808cdf6 100644
> --- a/tests/pm_backlight.c
> +++ b/tests/pm_backlight.c
> @@ -98,8 +98,8 @@ static int backlight_write(int value, const char *fname)
>
> static void test_and_verify(struct context *context, int val)
> {
> + const int tolerance = val * TOLERANCE / 100;
> int result;
> - int tolerance = val * TOLERANCE / 100;
>
> igt_assert_eq(backlight_write(val, "brightness"), 0);
> igt_assert_eq(backlight_read(&result, "brightness"), 0);
> @@ -107,9 +107,11 @@ static void test_and_verify(struct context *context, int val)
> igt_assert_eq(result, val);
>
> igt_assert_eq(backlight_read(&result, "actual_brightness"), 0);
> - /* Some rounding may happen depending on hw. Just check that it's close enough. */
> - igt_assert_lte(result, min(context->max, val + tolerance));
> - igt_assert_lte(max(0, val - tolerance), result);
> + /* Some rounding may happen depending on hw */
> + igt_assert_f(result >= max(0, val - tolerance) &&
> + result <= min(context->max, val + tolerance),
> + "actual_brightness [%d] did not match expected brightness [%d +- %d]\n",
> + result, val, tolerance);
Looks equivalent.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> }
>
> static void test_brightness(struct context *context)
> --
> 2.19.0.rc2
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
--
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
prev parent reply other threads:[~2018-09-07 14:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-07 8:12 [igt-dev] [PATCH i-g-t] igt/pm_backlight: Make the actual_brightness test readable Chris Wilson
2018-09-07 8:56 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-09-07 13:57 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-09-07 14:39 ` Ville Syrjälä [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=20180907143902.GG5565@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@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;
as well as URLs for NNTP newsgroup(s).