Perhaps consider using subtests, so that one problem doesn't prevent other parts of the test from running; and so the individual cases show up in the results summary.?
-- Chris On Sat, Aug 24, 2013 at 3:52 PM, Timothy Arceri <[email protected]> wrote: > Signed-off-by: Timothy Arceri <[email protected]> > --- > tests/all.tests | 5 + > tests/spec/khr_debug/CMakeLists.gl.txt | 14 ++ > tests/spec/khr_debug/CMakeLists.txt | 1 + > tests/spec/khr_debug/debug-object-label.c | 258 > ++++++++++++++++++++++++++++++ > 4 files changed, 278 insertions(+) > create mode 100644 tests/spec/khr_debug/CMakeLists.gl.txt > create mode 100644 tests/spec/khr_debug/CMakeLists.txt > create mode 100644 tests/spec/khr_debug/debug-object-label.c > > diff --git a/tests/all.tests b/tests/all.tests > index 128de58..6382729 100644 > --- a/tests/all.tests > +++ b/tests/all.tests > @@ -1203,6 +1203,11 @@ arb_debug_output = Group() > spec['ARB_debug_output'] = arb_debug_output > add_plain_test(arb_debug_output, 'arb_debug_output-api_error') > > +# Group KHR_debug > +khr_debug = Group() > +spec['KHR_debug'] = khr_debug > +add_plain_test(khr_debug, 'khr_debug-object-label') > + > # Group ARB_occlusion_query2 > arb_occlusion_query2 = Group() > spec['ARB_occlusion_query2'] = arb_occlusion_query2 > diff --git a/tests/spec/khr_debug/CMakeLists.gl.txt > b/tests/spec/khr_debug/CMakeLists.gl.txt > new file mode 100644 > index 0000000..b0079df > --- /dev/null > +++ b/tests/spec/khr_debug/CMakeLists.gl.txt > @@ -0,0 +1,14 @@ > +include_directories( > + ${GLEXT_INCLUDE_DIR} > + ${OPENGL_INCLUDE_PATH} > +) > + > +link_libraries ( > + piglitutil_${piglit_target_api} > + ${OPENGL_gl_LIBRARY} > + ${OPENGL_glu_LIBRARY} > +) > + > +piglit_add_executable (khr_debug-object-label debug-object-label.c) > + > +# vim: ft=cmake: > diff --git a/tests/spec/khr_debug/CMakeLists.txt > b/tests/spec/khr_debug/CMakeLists.txt > new file mode 100644 > index 0000000..144a306 > --- /dev/null > +++ b/tests/spec/khr_debug/CMakeLists.txt > @@ -0,0 +1 @@ > +piglit_include_target_api() > diff --git a/tests/spec/khr_debug/debug-object-label.c > b/tests/spec/khr_debug/debug-object-label.c > new file mode 100644 > index 0000000..a554d57 > --- /dev/null > +++ b/tests/spec/khr_debug/debug-object-label.c > @@ -0,0 +1,258 @@ > +/* > + * Copyright (c) 2013 Timothy Arceri <[email protected]> > + * > + * 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 > + * on the rights to use, copy, modify, merge, publish, distribute, sub > + * license, 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 > + * NON-INFRINGEMENT. IN NO EVENT SHALL AUTHORS AND/OR THEIR SUPPLIERS > + * 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-common.h" > + > +PIGLIT_GL_TEST_CONFIG_BEGIN > + > + config.supports_gl_compat_version = 11; > + > + config.window_visual = PIGLIT_GL_VISUAL_RGBA | > PIGLIT_GL_VISUAL_DOUBLE; > + > +PIGLIT_GL_TEST_CONFIG_END > + > +enum piglit_result > +piglit_display(void) > +{ > + return PIGLIT_PASS; > +} > + > +static void test_object_ptr_label() > +{ > + GLsync sync; > + GLsizei length; > + GLchar label[11]; > + > + /* basic check to see if glObjectPtrLabel/glGetObjectPtrLabel > + * set/get the label > + */ > + sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); > + glObjectPtrLabel(sync, -1, "Test Label"); > + glGetObjectPtrLabel(sync, 12, &length, label); > + > + if (length != 10 || (strcmp("Test Label", label) != 0)) { > + puts(" label or length does not match"); > + printf("label: %s length: %i\n", label, length); > + puts("Expected label: Test Label Expected length: 10"); > + piglit_report_result(PIGLIT_FAIL); > + } > + glDeleteSync(sync); > + > + /* An INVALID_VALUE is generated if the <ptr> parameter of ObjectPtrLabel > + * is not the name of a sync object. > + */ > + glObjectPtrLabel(NULL, length, label); > + > + if (!piglit_check_gl_error(GL_INVALID_VALUE)) { > + puts(" GL_INVALID_VALUE should be genereated when ObjectPtrLabel()" > + " ptr is not the name of a sync object"); > + piglit_report_result(PIGLIT_FAIL); > + } > +} > + > +static void test_object_label() > +{ > + GLsizei numBuffers = 1; > + GLsizei length; > + GLuint buffers[numBuffers]; > + GLuint invalidBufferName; > + GLint maxLabelLength; > + GLchar label[11]; > + GLchar *bigLabel; > + int i; > + > + glGenBuffers(numBuffers, buffers); > + > + /* An INVALID_VALUE error is generated if the number of characters in > + * <label>, excluding the null terminator when <length> is negative, is > not > + * less than the value of MAX_LABEL_LENGTH. > + */ > + glGetIntegerv(GL_MAX_LABEL_LENGTH, &maxLabelLength); > + bigLabel = (char *) malloc(maxLabelLength); > + for (i = 0; i <maxLabelLength; i++) { > + bigLabel[i] = 'a'; > + } > + bigLabel[maxLabelLength] = '\0'; > + > + glBindBuffer(GL_ARRAY_BUFFER, buffers[0]); > + glObjectLabel(GL_BUFFER, buffers[0], -1, bigLabel); > + > + if (!piglit_check_gl_error(GL_INVALID_VALUE)) { > + puts(" GL_INVALID_VALUE should be genereated when label >= > MAX_LABEL_LENGTH"); > + piglit_report_result(PIGLIT_FAIL); > + } > + > + /* If <label> is NULL, any debug label is effectively removed from the > object. > + */ > + glObjectLabel(GL_BUFFER, buffers[0], -1, "Test Label"); > + glObjectLabel(GL_BUFFER, buffers[0], -1, NULL); > + glGetObjectLabel(GL_BUFFER, buffers[0], 11, &length, label); > + > + if (length != 0 || (strcmp("", label) != 0)) { > + puts(" setting label to NULL should remove the label"); > + printf("label: %s length: %i\n", label, length); > + piglit_report_result(PIGLIT_FAIL); > + } > + > + /* An INVALID_ENUM error is generated by ObjectLabel if <identifier> is > not > + * one of the object types. > + */ > + glObjectLabel(GL_ARRAY_BUFFER, buffers[0], -1, "Test Label"); > + > + if (!piglit_check_gl_error(GL_INVALID_ENUM)) { > + puts(" GL_INVALID_ENUM should be genereated when the ObjectLabel > identifier is invalid"); > + piglit_report_result(PIGLIT_FAIL); > + } > + > + /* An INVALID_VALUE error is generated by ObjectLabel if <name> is not > + * the name of a valid object of the type specified by <identifier>. > + */ > + invalidBufferName = buffers[0]; > + glDeleteBuffers(numBuffers, buffers); > + glObjectLabel(GL_BUFFER, invalidBufferName, -1, "Test Label"); > + > + if (!piglit_check_gl_error(GL_INVALID_VALUE)) { > + puts(" GL_INVALID_VALUE should be genereated when the ObjectLabel > name is invalid"); > + piglit_report_result(PIGLIT_FAIL); > + } > + > +} > + > +static void test_get_object_label() > +{ > + GLsizei numBuffers = 5; > + GLsizei length; > + GLuint buffers[numBuffers]; > + GLuint invalidBufferName; > + GLchar label[12]; > + > + > + glGenBuffers(numBuffers, buffers); > + > + /* The maximum number of characters that may > + * be written into <label>, including the null terminator, is specified by > + * <bufSize>. > + */ > + glBindBuffer(GL_ARRAY_BUFFER, buffers[0]); > + glObjectLabel(GL_BUFFER, buffers[0], -1, "Test Label"); > + glGetObjectLabel(GL_BUFFER, buffers[0], 10, &length, label); > + > + if (length != 9 || (strcmp("Test Labe", label) != 0)) { > + puts(" bufSize should limit the maximum label length to 9"); > + printf("label: %s length: %i\n", label, length); > + piglit_report_result(PIGLIT_FAIL); > + } > + > + /* If no debug label was specified for the object then <label> > + * will contain a null-terminated empty string, and zero will be returned > + * in <length>. > + */ > + glBindBuffer(GL_ARRAY_BUFFER, buffers[1]); > + glGetObjectLabel(GL_BUFFER, buffers[1], 11, &length, label); > + > + if (length != 0 || (strcmp("", label) != 0)) { > + puts(" label should be empty and length 0"); > + printf("label: %s length: %i\n", label, length); > + piglit_report_result(PIGLIT_FAIL); > + } > + > + /* If <label> is NULL and <length> is non-NULL then no string > + * will be returned and the length of the label will be returned in > + * <length>. > + */ > + glBindBuffer(GL_ARRAY_BUFFER, buffers[2]); > + glObjectLabel(GL_BUFFER, buffers[2], -1, "Test Label"); > + glGetObjectLabel(GL_BUFFER, buffers[2], 11, &length, NULL); > + > + if (length != 10) { > + puts(" label length should be 10"); > + printf("length: %i\n", length); > + piglit_report_result(PIGLIT_FAIL); > + } > + > + /* If <length> is NULL, no length is returned. > + */ > + glBindBuffer(GL_ARRAY_BUFFER, buffers[3]); > + glObjectLabel(GL_BUFFER, buffers[3], -1, "Test Label"); > + glGetObjectLabel(GL_BUFFER, buffers[3], 11, NULL, label); > + > + if (strcmp("Test Label", label) != 0) { > + puts(" label doent match expected string when length NULL"); > + printf("label: %s\n expected: Test Label", label); > + piglit_report_result(PIGLIT_FAIL); > + } > + > + /* <label> will be null-terminated. The actual number of > + * characters written into <label>, > + * excluding the null terminator, is returned in <length>. > + */ > + glBindBuffer(GL_ARRAY_BUFFER, buffers[4]); > + glObjectLabel(GL_BUFFER, buffers[4], -1, "Test Label"); > + glGetObjectLabel(GL_BUFFER, buffers[4], 12, &length, label); > + > + if (length != 10 || (strcmp("Test Label", label) != 0)) { > + puts(" label or length does not match"); > + printf("label: %s length: %i\n", label, length); > + puts("Expected label: Test Label Expected length: 10"); > + piglit_report_result(PIGLIT_FAIL); > + } > + > + /* An INVALID_ENUM error is generated by GetObjectLabel if identifier is > not > + * one of the valid object types > + */ > + glGetObjectLabel(GL_ARRAY_BUFFER, buffers[4], 11, &length, label); > + > + if (!piglit_check_gl_error(GL_INVALID_ENUM)) { > + puts(" GL_INVALID_ENUM should be genereated when GetObjectLabel > identifier is invalid"); > + piglit_report_result(PIGLIT_FAIL); > + } > + > + /* An INVALID_VALUE error is generated by GetObjectLabel if <name> is not > + * the name of a valid object of the type specified by <identifier>. > + */ > + invalidBufferName = buffers[4]; > + glDeleteBuffers(numBuffers, buffers); > + glGetObjectLabel(GL_BUFFER, invalidBufferName, 11, &length, label); > + > + if (!piglit_check_gl_error(GL_INVALID_VALUE)) { > + puts(" GL_INVALID_VALUE should be genereated when GetObjectLabel name > is invalid"); > + piglit_report_result(PIGLIT_FAIL); > + } > +} > + > +void piglit_init(int argc, char **argv) > +{ > + piglit_automatic = GL_TRUE; > + piglit_require_extension("GL_KHR_debug"); > + piglit_require_extension("GL_ARB_sync"); > + > + if (!piglit_check_gl_error(GL_NO_ERROR)) > + piglit_report_result(PIGLIT_FAIL); > + > + test_object_label(); > + test_get_object_label(); > + test_object_ptr_label(); > + > + piglit_report_result(PIGLIT_PASS); > +} > -- > 1.8.3.1 > > _______________________________________________ > Piglit mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/piglit _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
