diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-03-24 20:52:44 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-03-24 21:35:25 +0000 |
commit | e08ed8a272fda96b8f7224985177f313c3b2ddf6 (patch) | |
tree | 5fdba2e2cade4db9f64582e6414c3372a5681180 /tests/kms_sink_crc_basic.c | |
parent | 58de785468782f29e6eb1d32d47b55b3d234dfcf (diff) |
lib/debugfs: Phase out igt_debugfs_fopen()
Wrapping fdopen() proved dangerous, the underlying fd is not refcounted,
and we must close it in the library or else we easily leak and exhaust
all fd. Since we can't provide igt_debugfs_fopen(), move the burden onto
the caller for those that require a stream FILE*.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/kms_sink_crc_basic.c')
-rw-r--r-- | tests/kms_sink_crc_basic.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/kms_sink_crc_basic.c b/tests/kms_sink_crc_basic.c index f8f814f2..c547e6e3 100644 --- a/tests/kms_sink_crc_basic.c +++ b/tests/kms_sink_crc_basic.c @@ -23,6 +23,7 @@ */ #include "igt.h" +#include "igt_sysfs.h" #include <errno.h> #include <limits.h> #include <stdbool.h> @@ -47,16 +48,13 @@ typedef struct { } data_t; static void get_crc(data_t *data, char *crc) { - int ret; - FILE *file; - - file = igt_debugfs_fopen(data->drm_fd, "i915_sink_crc_eDP1", "r"); - igt_require(file); + int dir; - ret = fscanf(file, "%s\n", crc); - igt_require(ret > 0); + dir = igt_debugfs_dir(data->drm_fd); + igt_require_f(igt_sysfs_scanf(dir, "i915_sink_crc_eDP1", "%s\n", crc), + "Sink CRC is unreliable on this machine. Try manual debug with --interactive-debug=no-crc\n"); + close(dir); - fclose(file); /* Black screen is always invalid */ igt_assert(strcmp(crc, CRC_BLACK) != 0); |