[Piglit] [PATCH v2 06/10] GL3.2 GL_ARB_sync: Test that GetSynciv sets correct error codes.

Chad Versace chad.versace at linux.intel.com
Mon Sep 30 12:40:01 PDT 2013


On 08/20/2013 11:26 AM, Nicholas Mack wrote:
> v2: Fix comments, initialize variables
> ---
>   tests/spec/arb_sync/CMakeLists.gl.txt  |  1 +
>   tests/spec/arb_sync/GetSynciv-errors.c | 94 ++++++++++++++++++++++++++++++++++
>   2 files changed, 95 insertions(+)
>   create mode 100644 tests/spec/arb_sync/GetSynciv-errors.c


Again, the test needs to added to all.tests.


> +/**


Again, a \file command is needed here.


> + * Test GetSynciv() sets correct error codes
> + *
> + * Section 6.1.7(Sync Object Queries) of OpenGL 3.2 Core says:
> + *  (For GetSynciv) "If sync is not the name of a sync object, an INVALID_VALUE
> + *  error is generated. If pname is not one of the values described above, an
> + *  INVALID_ENUM error is generated."
> + *
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +config.supports_gl_compat_version = 10;
> +config.supports_gl_core_version = 31;


Lines inside the CONFIG block should be indented.


> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +	/* UNREACHED */
> +	return PIGLIT_FAIL;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +	bool pass = true;
> +	GLsync a;
> +	GLsync b = (GLsync) 0x1373;


This test would be much easier to understand if 'a' and 'b' were
renamed 'valid_fence' and 'invalid_fence'.


> +
> +	GLsizei len;
> +	GLint val;
> +
> +	if (piglit_get_gl_version() < 32) {
> +		piglit_require_extension("GL_ARB_sync");
> +	}
> +
> +	a = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
> +
> +	/* test that valid sync results in NO_ERROR */
> +	glGetSynciv(a, GL_SYNC_STATUS, 1, &len, &val);
> +	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;


This first case should be removed because it duplicates a testcase
below.


> +
> +	/* test that invalid sync results in INVALID_VALUE */
> +	glGetSynciv(b, GL_SYNC_STATUS, 1, &len, &val);
> +	pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
> +
> +	/* test valid pname values result in NO_ERROR */
> +	glGetSynciv(a, GL_OBJECT_TYPE, 1, &len, &val);
> +	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
> +
> +	glGetSynciv(a, GL_SYNC_STATUS, 1, &len, &val);
> +	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
> +
> +	glGetSynciv(a, GL_SYNC_CONDITION, 1, &len, &val);
> +	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
> +
> +	glGetSynciv(a, GL_SYNC_FLAGS, 1, &len, &val);
> +	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
> +
> +	/* test that invalid pname results in INVALID_ENUM */
> +	glGetSynciv(a, GL_INVALID_VALUE, 1, &len, &val);
> +	pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
> +
> +	glDeleteSync(a);
> +
> +	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
> +}


Other than those issues, the test looks correct.



More information about the Piglit mailing list