public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Tauro, Riana" <riana.tauro@intel.com>
To: Ashutosh Dixit <ashutosh.dixit@intel.com>,
	<igt-dev@lists.freedesktop.org>,
	Anshuman Gupta <anshuman.gupta@intel.com>,
	Badal Nilawar <badal.nilawar@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 2/3] i915/i915_hwmon: General verification of hwmon attributes
Date: Tue, 13 Dec 2022 18:19:57 +0530	[thread overview]
Message-ID: <d9f4102f-2a09-0fa2-9d33-97a729f2d9d1@intel.com> (raw)
In-Reply-To: <20221212061233.2220742-3-ashutosh.dixit@intel.com>


Hi Ashutosh

On 12/12/2022 11:42 AM, Ashutosh Dixit wrote:
> Ensure we can read all hwmon attributes. For writable attributes, also
> ensure the read value approximately matches the written value, taking the
> clamping of writes into account.
> 
> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> ---
>   tests/i915/i915_hwmon.c | 82 +++++++++++++++++++++++++++++++++++++++++
>   tests/meson.build       |  1 +
>   2 files changed, 83 insertions(+)
>   create mode 100644 tests/i915/i915_hwmon.c
> 
> diff --git a/tests/i915/i915_hwmon.c b/tests/i915/i915_hwmon.c
> new file mode 100644
> index 00000000000..a0b2c48a96d
> --- /dev/null
> +++ b/tests/i915/i915_hwmon.c
> @@ -0,0 +1,82 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2021 Intel Corporation
> + */
> +
Year 2022

Thanks
Riana
> +#include <dirent.h>
> +#include <sys/stat.h>
> +#include "igt.h"
> +#include "igt_hwmon.h"
> +#include "igt_sysfs.h"
> +
> +IGT_TEST_DESCRIPTION("Tests for i915 hwmon");
> +
> +static void hwmon_read(int hwm)
> +{
> +	struct dirent *de;
> +	char val[128];
> +	DIR *dir;
> +
> +	dir = fdopendir(dup(hwm));
> +	igt_assert(dir);
> +	rewinddir(dir);
> +
> +	while ((de = readdir(dir))) {
> +		if (de->d_type != DT_REG || !strcmp(de->d_name, "uevent"))
> +			continue;
> +
> +		igt_assert(igt_sysfs_scanf(hwm, de->d_name, "%127s", val) == 1);
> +		igt_debug("'%s': %s\n", de->d_name, val);
> +
> +	}
> +	closedir(dir);
> +}
> +
> +static void hwmon_write(int hwm)
> +{
> +	struct dirent *de;
> +	struct stat st;
> +	DIR *dir;
> +
> +	dir = fdopendir(dup(hwm));
> +	igt_assert(dir);
> +	rewinddir(dir);
> +
> +	while ((de = readdir(dir))) {
> +		if (de->d_type != DT_REG || !strcmp(de->d_name, "uevent"))
> +			continue;
> +
> +		igt_assert(!fstatat(hwm, de->d_name, &st, 0));
> +		if (!(st.st_mode & 0222))
> +			continue;
> +
> +		igt_sysfs_clamped_attr_verify(hwm, de->d_name);
> +	}
> +	closedir(dir);
> +}
> +
> +igt_main
> +{
> +	int fd, hwm;
> +
> +	igt_fixture {
> +		fd = drm_open_driver_master(DRIVER_INTEL);
> +		hwm = igt_hwmon_open(fd);
> +		igt_require(hwm >= 0);
> +	}
> +
> +	igt_describe("Verify we can read all hwmon attributes");
> +	igt_subtest("hwmon-read") {
> +		hwmon_read(hwm);
> +	}
> +
> +	igt_describe("Verify writable hwmon attributes");
> +	igt_subtest("hwmon-write") {
> +		hwmon_write(hwm);
> +	}
> +
> +	igt_fixture {
> +		close(hwm);
> +		close(fd);
> +	}
> +}
> diff --git a/tests/meson.build b/tests/meson.build
> index 619c18b2516..a593055c23a 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -211,6 +211,7 @@ i915_progs = [
>   	'i915_fb_tiling',
>   	'i915_getparams_basic',
>   	'i915_hangman',
> +	'i915_hwmon',
>   	'i915_module_load',
>   	'i915_pciid',
>   	'i915_pipe_stress',

  reply	other threads:[~2022-12-13 12:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12  6:12 [igt-dev] [PATCH i-g-t 0/3] i915/i915_hwmon: General verification of hwmon attributes Ashutosh Dixit
2022-12-12  6:12 ` [igt-dev] [PATCH i-g-t 1/3] lib/igt_sysfs: Generic verification of clamped sysfs attributes Ashutosh Dixit
2022-12-12  6:12 ` [igt-dev] [PATCH i-g-t 2/3] i915/i915_hwmon: General verification of hwmon attributes Ashutosh Dixit
2022-12-13 12:49   ` Tauro, Riana [this message]
2022-12-12  6:12 ` [igt-dev] [PATCH i-g-t 3/3] HAX: Add i915_hwmon* to fast-feedback.testlist Ashutosh Dixit
2022-12-12  7:02 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/i915_hwmon: General verification of hwmon attributes Patchwork
2022-12-12  8:19 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2022-12-14  3:09 [igt-dev] [PATCH i-g-t 0/3] " Ashutosh Dixit
2022-12-14  3:09 ` [igt-dev] [PATCH i-g-t 2/3] " Ashutosh Dixit
2022-12-15  2:31 [igt-dev] [PATCH i-g-t 0/3] " Ashutosh Dixit
2022-12-15  2:31 ` [igt-dev] [PATCH i-g-t 2/3] " Ashutosh Dixit
2022-12-15  5:30   ` Tauro, Riana

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=d9f4102f-2a09-0fa2-9d33-97a729f2d9d1@intel.com \
    --to=riana.tauro@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=badal.nilawar@intel.com \
    --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