[igt-dev] [RFC] igt/debugfs_test: Increase timeout for long open debugfs.

Antonio Argenziano antonio.argenziano at intel.com
Tue Oct 2 22:29:21 UTC 2018


While most debugFS's open is quick, guc_log_dump, when guc is loaded,
might take a long time. Increase the timeout for such debugFSs.

Sending this as an RFC because I am not sure it will apply to more debugfs or
if it would be best to just move the guc_* files into another subtest.

Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
---
 tests/debugfs_test.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tests/debugfs_test.c b/tests/debugfs_test.c
index 2e87e442..5dfa4118 100644
--- a/tests/debugfs_test.c
+++ b/tests/debugfs_test.c
@@ -27,6 +27,23 @@
 #include <sys/types.h>
 #include <dirent.h>
 
+static bool is_long_open(const char *name)
+{
+	/* White list debugFSs that take a longer time to open. */
+	const char* slow_debugfs[] = {
+				"i915_guc_log_dump",
+				NULL
+	};
+	bool found = false;
+	int i = 0;
+
+	while (!found && slow_debugfs[i])	{
+		found = !!strncmp(name, slow_debugfs[i], sizeof(slow_debugfs[i++]));
+	}
+
+	return found;
+}
+
 static void read_and_discard_sysfs_entries(int path_fd, int indent)
 {
 	struct dirent *dirent;
@@ -63,7 +80,8 @@ static void read_and_discard_sysfs_entries(int path_fd, int indent)
 
 			igt_kmsg(KMSG_DEBUG "Reading file \"%s\"\n", dirent->d_name);
 			igt_debug("%sReading file \"%s\"\n", tabs, dirent->d_name);
-			igt_set_timeout(5, "reading sysfs entry");
+
+			igt_set_timeout(5 * (is_long_open(dirent->d_name) ? 10 : 1), "reading sysfs entry");
 
 			sub_fd = openat(path_fd, dirent->d_name, O_RDONLY);
 			if (sub_fd == -1) {
-- 
2.16.2



More information about the igt-dev mailing list