summaryrefslogtreecommitdiff
path: root/runner
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2018-10-02 10:45:42 +0300
committerPetri Latvala <petri.latvala@intel.com>2018-10-03 13:28:59 +0300
commit267870165d9ef66b4ab423e4efe7bacba023d75e (patch)
tree225826e876beb4aaa69374bbbb96a796f28698cb /runner
parentb82c9c97efa66668de172ad04deb83c9675f6a97 (diff)
runner: Add a unit test that checks for fd leaks
Pretty much needed, as proven. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'runner')
-rw-r--r--runner/runner_tests.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/runner/runner_tests.c b/runner/runner_tests.c
index 3705d711..37d27123 100644
--- a/runner/runner_tests.c
+++ b/runner/runner_tests.c
@@ -1003,6 +1003,24 @@ igt_main
}
}
+ igt_subtest("file-descriptor-leakage") {
+ int i;
+
+ /*
+ * This is a build-time test, and it's expected that
+ * all subtests are normally run. Keep this one at the
+ * end.
+ *
+ * Try to close some number of fds after stderr and
+ * expect EBADF for each one.
+ */
+ for (i = 3; i < 400; i++) {
+ errno = 0;
+ igt_assert_neq(close(i), 0);
+ igt_assert_eq(errno, EBADF);
+ }
+ }
+
igt_fixture
free_settings(&settings);
}