Re: [PATCH igt] igt/gem_fd_exhaustion: Remove stale assert

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 20, 2017 at 11:24:19AM +0100, Chris Wilson wrote:
> __gem_create() doesn't touch the outparam *handle on failure, so we can
> no longer assert that it zero. This is reasonable to remove as it is just
> testing the library itself and not the kernel, so no loss in coverage.
> We already had to remove the false assertion that gem_create() must fail
> following fd exhaustion (as we can not prevent the kernel from freeing
> VFS fdspace in between calls).
> 
> The last remaining change is that we do no need to rely on an external
> path for open() as dup() will do the job of exhausting the fdtable.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103365
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

Reviewed-by: Michał Winiarski <michal.winiarski@xxxxxxxxx>

But do we really need this test? Perhaps we could just remove it?

-Michał

> ---
>  tests/gem_fd_exhaustion.c | 21 ++++-----------------
>  1 file changed, 4 insertions(+), 17 deletions(-)
> 
> diff --git a/tests/gem_fd_exhaustion.c b/tests/gem_fd_exhaustion.c
> index 250fe850..0969f9c6 100644
> --- a/tests/gem_fd_exhaustion.c
> +++ b/tests/gem_fd_exhaustion.c
> @@ -33,11 +33,6 @@
>  #include <fcntl.h>
>  #include <limits.h>
>  
> -
> -
> -#define FD_ARR_SZ 100
> -int fd_arr[FD_ARR_SZ];
> -
>  static bool allow_unlimited_files(void)
>  {
>  	struct rlimit rlim;
> @@ -60,31 +55,23 @@ static bool allow_unlimited_files(void)
>  
>  igt_simple_main
>  {
> -	int fd, i;
> +	int fd;
>  
>  	igt_require(allow_unlimited_files());
>  
>  	fd = drm_open_driver(DRIVER_INTEL);
>  
> -	igt_assert(open("/dev/null", O_RDONLY) >= 0);
> -
>  	igt_fork(n, 1) {
>  		igt_drop_root();
>  
> -		for (i = 0; ; i++) {
> -			int tmp_fd = open("/dev/null", O_RDONLY);
> +		for (int i = 0; ; i++) {
> +			int leak = dup(fd);
>  			uint32_t handle;
>  
> -			if (tmp_fd >= 0 && i < FD_ARR_SZ)
> -				fd_arr[i] = tmp_fd;
> -
>  			if (__gem_create(fd, 4096, &handle) == 0)
>  				gem_close(fd, handle);
>  
> -
> -			if (tmp_fd < 0) {
> -				/* Ensure we actually hit the failure path ... */
> -				igt_assert(handle == 0);
> +			if (leak < 0) {
>  				igt_info("fd exhaustion after %i rounds.\n", i);
>  				break;
>  			}
> -- 
> 2.15.0.rc1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux