[igt-dev] [PATCH i-g-t 2/2] tests/i915_query: split garbage test

Chris Wilson chris at chris-wilson.co.uk
Tue Mar 13 09:50:44 UTC 2018


Quoting Lionel Landwerlin (2018-03-13 09:17:55)
> Unfortunately I forgot that some of those tests require rcs topology
> support which we don't have on Sandybridge. This change split the test
> in 2 (first part available on all platforms, second part only with rcs
> topology support).
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105475
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

Aside, why are the flags prefixed with DRM_I915_QUERY and not just
I915_QUERY matching the rest of the uAPI? In fact, the whole perf abi is
special. ARGH.

> ---
>  tests/i915_query.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/i915_query.c b/tests/i915_query.c
> index 328c54bc..c7de8cbd 100644
> --- a/tests/i915_query.c
> +++ b/tests/i915_query.c
> @@ -69,9 +69,7 @@ static bool has_query_supports(int fd)
>  static void test_query_garbage(int fd)
>  {
>         struct drm_i915_query query;
> -       struct drm_i915_query_item items[2];
> -       struct drm_i915_query_item *items_ptr;
> -       int i, n_items;
> +       struct drm_i915_query_item item;
>  
>         /* Verify that invalid query pointers are rejected. */
>         igt_assert_eq(__i915_query(fd, NULL), -EFAULT);
> @@ -90,8 +88,15 @@ static void test_query_garbage(int fd)
>         i915_query_items_err(fd, (void *) 0, 1, EFAULT);
>  
>         /* Test the invalid query id = 0. */
> -       memset(items, 0, sizeof(items));
> -       i915_query_items_err(fd, items, 1, EINVAL);
> +       memset(&item, 0, sizeof(item));
> +       i915_query_items_err(fd, &item, 1, EINVAL);
> +}
> +
> +static void test_query_garbage_items(int fd)
> +{
> +       struct drm_i915_query_item items[2];
> +       struct drm_i915_query_item *items_ptr;
> +       int i, n_items;
>  
>         /*
>          * Query item flags field is currently valid only if equals to 0.
> @@ -486,6 +491,11 @@ igt_main
>         igt_subtest("query-garbage")
>                 test_query_garbage(fd);
>  
> +       igt_subtest("query-garbage-items") {
> +               igt_require(query_topology_supported(fd));
> +               test_query_garbage_items(fd);
> +       }
> +
>         igt_subtest("query-topology-kernel-writes") {
>                 igt_require(query_topology_supported(fd));
>                 test_query_topology_kernel_writes(fd);

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the igt-dev mailing list