[PATCH i-g-t v2 05/10] tests/intel/xe_drm_fdinfo: Be strict on == 0 comparison

Lucas De Marchi lucas.demarchi at intel.com
Tue Aug 27 15:09:34 UTC 2024


On Mon, Aug 26, 2024 at 10:51:24PM GMT, Lucas De Marchi wrote:
>Do not compare the percent to 0, just make sure there's not a single
>tick in those cycles.
>
>Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
>---
> tests/intel/xe_drm_fdinfo.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/tests/intel/xe_drm_fdinfo.c b/tests/intel/xe_drm_fdinfo.c
>index 1b5980752..ad563aa20 100644
>--- a/tests/intel/xe_drm_fdinfo.c
>+++ b/tests/intel/xe_drm_fdinfo.c
>@@ -489,7 +489,8 @@ check_results(struct pceu_cycles *s1, struct pceu_cycles *s2,
> 		igt_assert_lt_double(95.0, percent);
> 		igt_assert_lt_double(percent, 105.0);
> 	} else {
>-		igt_assert(!percent);
>+		igt_assert(!s2[class].cycles);
>+		igt_assert(!s1[class].cycles);

oops, that is wrong. should have been something like

	igt_assert_eq(s2[class].cycles - s1[class].cycles);

or even adding a `u64 num; u64 den;` to help in the calculation above.

> 	}
> }
>
>-- 
>2.43.0
>


More information about the igt-dev mailing list