Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: priyanka.dandamudi@intel.com, janga.rahul.kumar@intel.com,
	tejas.upadhyay@intel.com, igt-dev@lists.freedesktop.org,
	ramadevi.gandi@intel.com
Subject: Re: [igt-dev] [PATCH i-g-t 2/3] xe/xe_sysfs_defaults: Verify .defaults in engines directory
Date: Tue, 4 Jul 2023 14:06:03 +0100	[thread overview]
Message-ID: <82c2d355-a24a-482a-129c-abfc6eb38b66@linux.intel.com> (raw)
In-Reply-To: <20230629054339.636091-3-priyanka.dandamudi@intel.com>


On 29/06/2023 06:43, priyanka.dandamudi@intel.com wrote:
> From: Priyanka Dandamudi <priyanka.dandamudi@intel.com>
> 
> Add a new test which verifies .defaults are readonly and all
> parameters are present.
> 
> v2: Addressed small changes.(Kamil)
> 
> v3: Added debug for default value.(Rahul)
> 
> Cc: Janga Rahul Kumar <janga.rahul.kumar@intel.com>
> Cc: Tejas Upadhyay <tejas.upadhyay@intel.com>
> Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi@intel.com>
> Reviewed-by: Janga Rahul Kumar <janga.rahul.kumar@intel.com>
> ---
>   tests/meson.build            |  1 +
>   tests/xe/xe_sysfs_defaults.c | 90 ++++++++++++++++++++++++++++++++++++
>   2 files changed, 91 insertions(+)
>   create mode 100644 tests/xe/xe_sysfs_defaults.c
> 
> diff --git a/tests/meson.build b/tests/meson.build
> index 85ea7e74e..b24bae5c2 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -270,6 +270,7 @@ xe_progs = [
>   	'xe_vm',
>   	'xe_waitfence',
>   	'xe_spin_batch',
> +	'xe_sysfs_defaults',
>   ]
>   
>   msm_progs = [
> diff --git a/tests/xe/xe_sysfs_defaults.c b/tests/xe/xe_sysfs_defaults.c
> new file mode 100644
> index 000000000..a1df312e7
> --- /dev/null
> +++ b/tests/xe/xe_sysfs_defaults.c
> @@ -0,0 +1,90 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2023 Intel Corporation
> + */
> +
> +/**
> + * TEST: xe sysfs defaults
> + * Category: Infrastructure
> + * Functionality: driver handler
> + * Run type: FULL
> + * Sub-category: xe
> + * Test category: SysMan
> + * SUBTEST: engine-defaults
> + */
> +

#include <fcntl.h>

Or it doesn't build, on Ubuntu 22.04 at least. Same for 
"xe/xe_sysfs_scheduler: Verify scheduler control interface"

Regards,

Tvrtko

> +#include <dirent.h>
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <unistd.h>
> +
> +#include "igt.h"
> +#include "igt_sysfs.h"
> +
> +#include "xe_drm.h"
> +#include "xe/xe_query.h"
> +
> +static void test_defaults(int xe, int engine, const char **property)
> +{
> +	struct dirent *de;
> +	int property_value;
> +	int defaults;
> +	DIR *dir;
> +
> +	defaults = openat(engine, ".defaults", O_DIRECTORY);
> +	igt_require(defaults != -1);
> +
> +	dir = fdopendir(engine);
> +	while ((de = readdir(dir))) {
> +		if (*de->d_name == '.')
> +			continue;
> +
> +		igt_debug("Checking attr '%s'\n", de->d_name);
> +
> +		igt_assert_f(property_value = igt_sysfs_get_u64(defaults, de->d_name),
> +			     "Default value %s is not present!\n", de->d_name);
> +
> +		igt_debug("Default property:%s, value:%d\n", de->d_name, property_value);
> +
> +		igt_assert_f(!igt_sysfs_set(defaults, de->d_name, "garbage"),
> +					    "write into default value of %s succeeded!\n",
> +					    de->d_name);
> +	}
> +	closedir(dir);
> +}
> +
> +igt_main
> +{
> +	int xe, sys_fd;
> +	int gt;
> +
> +	igt_fixture {
> +		xe = drm_open_driver(DRIVER_XE);
> +		xe_device_get(xe);
> +
> +		sys_fd = igt_sysfs_open(xe);
> +		igt_require(sys_fd != -1);
> +	}
> +
> +	igt_subtest_with_dynamic("engine-defaults") {
> +		xe_for_each_gt(xe, gt) {
> +			int engines_fd = -1;
> +			char buf[100];
> +
> +			sprintf(buf, "device/gt%d/engines", gt);
> +			engines_fd = openat(sys_fd, buf, O_RDONLY);
> +			igt_require(engines_fd != -1);
> +
> +			igt_sysfs_engines(xe, engines_fd, NULL, test_defaults);
> +
> +			close(engines_fd);
> +		}
> +	}
> +
> +	igt_fixture {
> +		close(sys_fd);
> +		xe_device_put(xe);
> +		close(xe);
> +	}
> +}
> +

  reply	other threads:[~2023-07-04 13:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29  5:43 [igt-dev] [PATCH i-g-t 0/3] Add tests for scheduler control interface priyanka.dandamudi
2023-06-29  5:43 ` [igt-dev] [PATCH i-g-t 1/3] lib/igt_sysfs: Add support to iterate over engines priyanka.dandamudi
2023-06-29  5:43 ` [igt-dev] [PATCH i-g-t 2/3] xe/xe_sysfs_defaults: Verify .defaults in engines directory priyanka.dandamudi
2023-07-04 13:06   ` Tvrtko Ursulin [this message]
2023-06-29  5:43 ` [igt-dev] [PATCH i-g-t 3/3] xe/xe_sysfs_scheduler: Verify scheduler control interface priyanka.dandamudi
2023-06-29  9:03 ` [igt-dev] ✓ Fi.CI.BAT: success for Add tests for scheduler control interface (rev4) Patchwork
2023-06-29 17:44 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-06-28  9:52 [igt-dev] [PATCH i-g-t 0/3] Add tests for scheduler control interface priyanka.dandamudi
2023-06-28  9:52 ` [igt-dev] [PATCH i-g-t 2/3] xe/xe_sysfs_defaults: Verify .defaults in engines directory priyanka.dandamudi
2023-06-28 12:41   ` Kumar, Janga Rahul

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=82c2d355-a24a-482a-129c-abfc6eb38b66@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=janga.rahul.kumar@intel.com \
    --cc=priyanka.dandamudi@intel.com \
    --cc=ramadevi.gandi@intel.com \
    --cc=tejas.upadhyay@intel.com \
    /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