[igt-dev] [PATCH i-g-t] lib: Shut some excessive debug messages up

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Jun 5 18:03:59 UTC 2023


From: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>

In case of tests which extensively use debugfs, tons of useless debug
messages about opening a debugfs directory are emitted.  If the test fails
then important debug messages with details of the failure, interleaved
with sequences of those useless messages, are hard to find and read.

Replace igt_debug() with conditional igt_debug_on_f() emitting a message
about debugfs directory path only if open() fails.

v2: emit a message on NULL debugfs path

Cc: Chris Wilson <chris.p.wilson at intel.com>
Cc: Marcin Bernatowicz <marcin.bernatowicz at linux.intel.com>
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 lib/igt_debugfs.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index afde2da62..a7b54bae5 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -208,13 +208,16 @@ char *igt_debugfs_path(int device, char *path, int pathlen)
  */
 int igt_debugfs_dir(int device)
 {
+	int debugfs_dir_fd;
 	char path[200];
 
-	if (!igt_debugfs_path(device, path, sizeof(path)))
+	if (igt_debug_on(!igt_debugfs_path(device, path, sizeof(path))))
 		return -1;
 
-	igt_debug("Opening debugfs directory '%s'\n", path);
-	return open(path, O_RDONLY);
+	debugfs_dir_fd = open(path, O_RDONLY);
+	igt_debug_on_f(debugfs_dir_fd < 0, "path: %s\n", path);
+
+	return debugfs_dir_fd;
 }
 
 /**
-- 
2.39.2



More information about the igt-dev mailing list