[igt-dev] [PATCH i-g-t 2/2] tests/i915/gem_fd_exhaustion.c: Expect ENFILE when fds run out
Chris Wilson
chris at chris-wilson.co.uk
Mon Apr 8 23:42:57 UTC 2019
Quoting Antonio Argenziano (2019-04-09 00:06:35)
>
>
> On 08/04/19 16:00, Chris Wilson wrote:
> > Quoting Antonio Argenziano (2019-04-08 23:52:00)
> >> Change the test to expect gem_create to return ENFILE when we run out of
> >> fds.
> >>
> >> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> >> Cc: Petri Latvala <petri.latvala at intel.com>
> >> Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
> >> ---
> >> tests/i915/gem_fd_exhaustion.c | 11 ++++++-----
> >> 1 file changed, 6 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/tests/i915/gem_fd_exhaustion.c b/tests/i915/gem_fd_exhaustion.c
> >> index 23602b98..83d0e926 100644
> >> --- a/tests/i915/gem_fd_exhaustion.c
> >> +++ b/tests/i915/gem_fd_exhaustion.c
> >> @@ -48,15 +48,16 @@ igt_simple_main
> >> int leak = open("/dev/null", O_RDONLY);
> >> uint32_t handle;
> >>
> >> - if (__gem_create(fd, 4096, &handle) == 0)
> >> - gem_close(fd, handle);
> >> -
> >> if (leak < 0) {
> >> igt_info("fd exhaustion after %i rounds.\n", i);
> >> - igt_assert(__gem_create(fd, 4096,
> >> - &handle) < 0);
> >> + igt_assert_eq(__gem_create(fd, 4096,
> >> + &handle), -ENFILE);
> >
> > It can also just fail by running out of memory, and memory says EMFILE.
>
> ret = __gem_create();
> ret == ENFILE || ret == EMFILE? Or is there something we could check
> beforehand so we know what to expect?
No, and I see little value in demanding that the failure matches.
The "test" is just that the kernel doesn't die or leak when we run out of
system resources. I suspect fault injection would do a better job of
providing coverage for the error paths.
-Chris
More information about the igt-dev
mailing list