[Piglit] [PATCH v2] egl: test that EGL_BAD_PARAMETER is returned for an invalid EGLImage attrib

Tapani Pälli tapani.palli at intel.com
Wed Jan 11 07:44:41 UTC 2017


Thanks;

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

Do you have Mesa fix coming up for this? Maybe commit that at same time 
to avoid QA hassle or then mention in commit message that this is 
expected to fail currently.


On 01/10/2017 05:12 PM, Micah Fedke wrote:
> This tests the following statement from EGL_KHR_image_base.txt:
> If an attribute specified in <attrib_list> is not one of the attributes
> listed in Table bbb, the error EGL_BAD_PARAMETER is generated.
>
> Signed-off-by: Micah Fedke <micah.fedke at collabora.co.uk>
> ---
>  tests/all.py                 |  2 +
>  tests/egl/CMakeLists.gl.txt  |  2 +
>  tests/egl/egl-invalid-attr.c | 92 ++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 96 insertions(+)
>  create mode 100644 tests/egl/egl-invalid-attr.c
>
> diff --git a/tests/all.py b/tests/all.py
> index e8de1b2..d25459b 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -4505,6 +4505,8 @@ with profile.test_list.group_manager(
>      g(['egl-create-largest-pbuffer-surface'],
>        'largest possible eglCreatePbufferSurface and then glClear',
>        run_concurrent=False)
> +    g(['egl-invalid-attr'],
> +      run_concurrent=False)
>
>  with profile.test_list.group_manager(
>          PiglitGLTest,
> diff --git a/tests/egl/CMakeLists.gl.txt b/tests/egl/CMakeLists.gl.txt
> index 3660e04..1d46035 100644
> --- a/tests/egl/CMakeLists.gl.txt
> +++ b/tests/egl/CMakeLists.gl.txt
> @@ -29,6 +29,8 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
>  	target_link_libraries(egl-configless-context pthread ${X11_X11_LIB})
>  	piglit_add_executable (egl-gl-colorspace egl-util.c egl-gl-colorspace.c)
>  	target_link_libraries(egl-gl-colorspace pthread ${X11_X11_LIB})
> +	piglit_add_executable (egl-invalid-attr egl-util.c egl-invalid-attr.c)
> +	target_link_libraries(egl-invalid-attr pthread ${X11_X11_LIB})
>  ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
>
>  # vim: ft=cmake:
> diff --git a/tests/egl/egl-invalid-attr.c b/tests/egl/egl-invalid-attr.c
> new file mode 100644
> index 0000000..7336778
> --- /dev/null
> +++ b/tests/egl/egl-invalid-attr.c
> @@ -0,0 +1,92 @@
> +/*
> + * Copyright © 2016 Collabora Ltd.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +#include "piglit-util-gl.h"
> +#include "piglit-util-egl.h"
> +#include "egl-util.h"
> +
> +/**
> + * @file egl-invalid-attr.c
> + *
> + * From EGL_KHR_image_base.txt: If an attribute specified in <attrib_list> is
> + * not one of the attributes listed in Table bbb, the error EGL_BAD_PARAMETER
> + * is generated.
> + */
> +
> +static enum piglit_result
> +draw(struct egl_state *state)
> +{
> +	GLuint tex;
> +	const unsigned char src[] = { 0x00, 0x00, 0x00, 0x00 };
> +	EGLint attr[] = {
> +		0xFFFF, 0, //invalid attr
> +		EGL_NONE
> +	};
> +	PFNEGLCREATEIMAGEKHRPROC peglCreateImageKHR = NULL;
> +
> +	peglCreateImageKHR =
> +           (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress("eglCreateImageKHR");
> +
> +	glGenTextures(1, &tex);
> +	glBindTexture(GL_TEXTURE_2D, tex);
> +
> +	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA,
> +	       GL_UNSIGNED_BYTE, src);
> +
> +	if (piglit_is_egl_extension_supported(eglGetCurrentDisplay(),
> +                                              "EGL_KHR_gl_texture_2D_image")) {
> +		peglCreateImageKHR(eglGetCurrentDisplay(),
> +                                   eglGetCurrentContext(),
> +                                   EGL_GL_TEXTURE_2D_KHR,
> +                                   (EGLClientBuffer)(intptr_t)tex,
> +                                   attr);
> +        } else {
> +		printf("EGL_KHR_gl_texture_2D_image not available, skipping\n");
> +		return PIGLIT_SKIP;
> +        }
> +
> +	if (!piglit_check_egl_error(EGL_BAD_PARAMETER)) {
> +		fprintf(stderr, "eglCreateImageKHR() "
> +			"error wasn't EGL_BAD_PARAMETER\n");
> +		piglit_report_result(PIGLIT_FAIL);
> +	}
> +
> +	glDeleteTextures(1, &tex);
> +
> +	return PIGLIT_PASS;
> +}
> +
> +int
> +main(int argc, char *argv[])
> +{
> +	struct egl_test test;
> +	const char *extensions[] = {"EGL_KHR_image_base", NULL};
> +
> +	egl_init_test(&test);
> +	test.draw = draw;
> +	test.extensions = extensions;
> +
> +	if (egl_util_run(&test, argc, argv) != PIGLIT_PASS)
> +		return EXIT_FAILURE;
> +	return EXIT_SUCCESS;
> +}
>


More information about the Piglit mailing list