[igt-dev] [PATCH i-g-t 1/1] tests/debugfs_test: Add basic-hwmon test

Riana Tauro riana.tauro at intel.com
Mon Oct 31 09:55:21 UTC 2022


Add a testcase that verifies hwmon directory in dgfx and prints all
the entries

Signed-off-by: Riana Tauro <riana.tauro at intel.com>
---
 tests/debugfs_test.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/debugfs_test.c b/tests/debugfs_test.c
index 0b4b6e23..99fef354 100644
--- a/tests/debugfs_test.c
+++ b/tests/debugfs_test.c
@@ -24,12 +24,13 @@
 
 #include "i915/gem.h"
 #include "igt.h"
+#include "igt_hwmon.h"
 #include "igt_sysfs.h"
 #include <fcntl.h>
 #include <sys/types.h>
 #include <dirent.h>
 
-IGT_TEST_DESCRIPTION("Read entries from debugfs and sysfs paths.");
+IGT_TEST_DESCRIPTION("Read entries from debugfs,hwmon and sysfs paths.");
 
 static void read_and_discard_sysfs_entries(int path_fd, int indent)
 {
@@ -178,7 +179,7 @@ retry:
 
 igt_main
 {
-	int fd = -1, debugfs, sysfs;
+	int fd = -1, debugfs, sysfs, hwmon_fd;
 
 	igt_fixture {
 		fd = drm_open_driver_master(DRIVER_INTEL);
@@ -196,6 +197,15 @@ igt_main
 	igt_subtest("read_all_entries")
 		read_and_discard_sysfs_entries(debugfs, 0);
 
+	igt_describe("Read all entries from hwmon path");
+	igt_subtest("basic-hwmon") {
+		igt_require_f(gem_has_lmem(fd), "Test applicable only for dgfx\n");
+		hwmon_fd = igt_hwmon_open(fd);
+		igt_assert(hwmon_fd >= 0);
+		read_and_discard_sysfs_entries(hwmon_fd, 0);
+		close(hwmon_fd);
+	}
+
 	igt_describe("Read all debugfs entries with display on/off.");
 	igt_subtest_group
 		kms_tests(fd, debugfs);
-- 
2.25.1



More information about the igt-dev mailing list