diff options
author | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2019-06-04 18:12:54 +0300 |
---|---|---|
committer | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2019-06-05 14:11:21 +0300 |
commit | 2d4f470bba1cb51ed116fb80b170f717c6294714 (patch) | |
tree | ceeb263ec5e0410311ee00221f5c0e8ff00f6550 /runner | |
parent | 79b74da4ae33d9778865d770c1b96204619a37e8 (diff) | |
download | platform_external_igt-gpu-tools-2d4f470bba1cb51ed116fb80b170f717c6294714.tar.gz platform_external_igt-gpu-tools-2d4f470bba1cb51ed116fb80b170f717c6294714.tar.bz2 platform_external_igt-gpu-tools-2d4f470bba1cb51ed116fb80b170f717c6294714.zip |
runner_tests: Fix the file descriptor leakage subtest
Some libraries (looking at you, GnuTLS) may leave fds opened after the
implicitly called library constructor. We don't have full control over
them as they may be dependencies of our dependencies and may get pulled
in if the user's and distribution's compile/configure/USE are just
right.
Let's close all the non-standard fds ahead of executing anything in the
igt_runner tests, so we can test for descriptor leakage caused by any of
the igt_runner code-paths exercised there.
Cc: Antonio Argenziano <antonio.argenziano@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
Reviewed-by: Simon Ser <simon.ser@intel.com>
Diffstat (limited to 'runner')
-rw-r--r-- | runner/runner_tests.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/runner/runner_tests.c b/runner/runner_tests.c index 1fc09688..c09cda70 100644 --- a/runner/runner_tests.c +++ b/runner/runner_tests.c @@ -208,8 +208,27 @@ igt_main { struct settings *settings = malloc(sizeof(*settings)); - igt_fixture + igt_fixture { + int i; + + /* + * Let's close all the non-standard fds ahead of executing + * anything, so we can test for descriptor leakage caused by + * any of the igt_runner code-paths exercised here. + * + * See file-descriptor-leakage subtest at the end. + * + * Some libraries (looking at you, GnuTLS) may leave fds opened + * after the implicitly called library constructor. We don't + * have full control over them as they may be dependencies of + * our dependencies and may get pulled in if the user's and + * distribution's compile/configure/USE are just right. + */ + for (i = 3; i < 400; i++) + close(i); + init_settings(settings); + } igt_subtest("default-settings") { const char *argv[] = { "runner", |