[Intel-gfx] [PATCH i-g-t] tests/debugfs_test: Use O_NONBLOCK

Chris Wilson chris at chris-wilson.co.uk
Sun Sep 8 16:19:50 UTC 2019


Since we are just reading from each debugfs file, any that requires
initial setup may not be fully setup or be left in a state that results
in the file *expectedly* waiting. Use O_NONBLOCK to avoid waits on
external events as we are just peeking for a trivial check that the
files do not explode.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/debugfs_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/debugfs_test.c b/tests/debugfs_test.c
index 6d1757c50..f8dd851c9 100644
--- a/tests/debugfs_test.c
+++ b/tests/debugfs_test.c
@@ -65,7 +65,7 @@ static void read_and_discard_sysfs_entries(int path_fd, int indent)
 			igt_debug("%sReading file \"%s\"\n", tabs, dirent->d_name);
 			igt_set_timeout(5, "reading sysfs entry");
 
-			sub_fd = openat(path_fd, dirent->d_name, O_RDONLY);
+			sub_fd = openat(path_fd, dirent->d_name, O_RDONLY | O_NONBLOCK);
 			if (sub_fd == -1) {
 				igt_debug("%sCould not open file \"%s\" with error: %m\n",
 					  tabs, dirent->d_name);
-- 
2.23.0



More information about the Intel-gfx mailing list