[igt-dev] [V2 i-g-t] tests/kms_cursor_crc: Fix SIGABRT in dynamic subtests

Dixit, Ashutosh ashutosh.dixit at intel.com
Mon Nov 14 20:08:24 UTC 2022


On Thu, 03 Nov 2022 19:00:05 -0700, Bhanuprakash Modem wrote:
>

Hi Bhanu, could you please fix the compile warnings below. Thanks.


> @@ -700,65 +700,78 @@ static void test_rapid_movement(data_t *data)
>	igt_assert_lt(usec, 0.9 * 400 * 1000000 / data->refresh);
>  }
>
> -static void run_size_tests(data_t *data, void (*testfunc)(data_t *),
> -			   int w, int h)
> +static void run_size_tests(data_t *data, int w, int h)
>  {
>	enum pipe pipe;
> +	struct {
> +		const char *name;
> +		void (*testfunc)(data_t *);
> +		const char *desc;
> +	} size_tests[] = {
> +		{ "cursor-onscreen", test_crc_onscreen,
> +			"Check if a given-size cursor is well-positioned inside the screen." },
> +		{ "cursor-offscreen", test_crc_offscreen,
> +			"Check if a given-size cursor is well-positioned outside the screen." },
> +		{ "cursor-sliding", test_crc_sliding,
> +			"Check the smooth and pixel-by-pixel given-size cursor movements on horizontal, vertical and diagonal." },
> +		{ "cursor-random", test_crc_random,
> +			"Check random placement of a cursor with given size." },
> +		{ "cursor-rapid-movement", test_rapid_movement,
> +			"Check the rapid update of given-size cursor movements." },
> +	};
> +	int i;
> +	char name[16];
>
>	if (w == 0 && h == 0) {
>		w = data->cursor_max_w;
>		h = data->cursor_max_h;
>
> -		/*
> -		 * No point in doing the "max-size" test if
> -		 * it was already covered by the other tests.
> -		 */
> -		if ((w == h) && (w <= 512) && (h <= 512) &&
> -		    is_power_of_two(w) && is_power_of_two(h)) {
> -			igt_info("Cursor max size %dx%d already covered by other tests\n", w, h);
> -			return;
> -		}
> +		strcpy(name, "max-size");
> +	} else {
> +		snprintf(name, sizeof(name), "%dx%d", w, h);

[305/1132] Compiling C object tests/kms_cursor_crc.p/kms_cursor_crc.c.o
../tests/kms_cursor_crc.c: In function ‘run_size_tests.constprop’:
../tests/kms_cursor_crc.c:731:50: warning: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size between 4 and 14 [-Wformat-truncation=]
  731 |                 snprintf(name, sizeof(name), "%dx%d", w, h);
      |                                                  ^~
../tests/kms_cursor_crc.c:731:46: note: directive argument in the range [-2147483648, 1024]
  731 |                 snprintf(name, sizeof(name), "%dx%d", w, h);
      |                                              ^~~~~~~
In file included from /usr/include/stdio.h:894,
		 from ../lib/igt_core.h:41,
		 from ../lib/drmtest.h:39,
		 from ../lib/igt.h:27,
		 from ../tests/kms_cursor_crc.c:25:
In function ‘snprintf’,
    inlined from ‘run_size_tests.constprop’ at ../tests/kms_cursor_crc.c:731:3:
/usr/include/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 4 and 24 bytes into a destination of size 16
   71 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   72 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~


More information about the igt-dev mailing list