[Piglit] [PATCH] GL_ARB_texture_buffer_object: New test for error behavior.

Illia Iorin illia.iorin at gmail.com
Mon Jun 4 13:45:37 UTC 2018


This test checks that if we allocate more memory for the buffer
 than possible, we get GL_OUT_OF_MEMORY error.

Signed-off-by: Illia Iorin <illia.iorin at globallogic.com>
---
 tests/opengl.py                               |  1 +
 .../CMakeLists.gl.txt                         |  1 +
 .../negative-bad-oom.c                        | 61 +++++++++++++++++++
 3 files changed, 63 insertions(+)
 create mode 100644 tests/spec/arb_texture_buffer_object/negative-bad-oom.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 9c43d32c9..56cf4f041 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -2365,6 +2365,7 @@ with profile.test_list.group_manager(
     g(['arb_texture_buffer_object-max-size'], 'max-size')
     g(['arb_texture_buffer_object-minmax'], 'minmax')
     g(['arb_texture_buffer_object-negative-bad-bo'], 'negative-bad-bo')
+    g(['arb_texture_buffer_object-negative-bad-oom'], 'negative-bad-oom')
     g(['arb_texture_buffer_object-negative-bad-format'], 'negative-bad-format')
     g(['arb_texture_buffer_object-negative-bad-target'], 'negative-bad-target')
     g(['arb_texture_buffer_object-negative-unsupported'],
diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
index 959ca0c2f..98d1e16d8 100644
--- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
@@ -25,3 +25,4 @@ piglit_add_executable (arb_texture_buffer_object-subdata-sync subdata-sync.c)
 piglit_add_executable (arb_texture_buffer_object-unused-name unused-name.c)
 piglit_add_executable (arb_texture_buffer_object-fetch-outside-bounds fetch-outside-bounds.c)
 piglit_add_executable (arb_texture_buffer_object-indexed indexed.c)
+piglit_add_executable (arb_texture_buffer_object-negative-bad-oom negative-bad-oom.c)
\ No newline at end of file
diff --git a/tests/spec/arb_texture_buffer_object/negative-bad-oom.c b/tests/spec/arb_texture_buffer_object/negative-bad-oom.c
new file mode 100644
index 000000000..f5c09a41b
--- /dev/null
+++ b/tests/spec/arb_texture_buffer_object/negative-bad-oom.c
@@ -0,0 +1,61 @@
+/* Copyright © 2018 Illia Iorin 
+ *
+ * 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.
+ */
+
+/**@file negative-bad-oom.c 
+* This test checks that if you allocate more memory than possible, 
+* the glGetError() will return  GL_OUT_OF_MEMORY error flag 
+*/
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_compat_version = 10;
+	config.supports_gl_core_version = 31;
+
+	config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+	config.khr_no_error_support = PIGLIT_HAS_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+	return PIGLIT_FAIL; /* UNREACHED */
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+	GLuint tex, tbo;
+	glGenBuffers(1, &tbo);
+	glBindBuffer(GL_TEXTURE_BUFFER, tbo);
+
+	glGenTextures(1, &tex);
+	glBindTexture(GL_TEXTURE_BUFFER, tex);
+	glTexBuffer(GL_TEXTURE_BUFFER, GL_R8, tbo);
+	glBufferData(GL_TEXTURE_BUFFER,
+		     INT_MAX , NULL, GL_STATIC_READ);
+	if (!piglit_check_gl_error(GL_OUT_OF_MEMORY))
+		piglit_report_result(PIGLIT_FAIL);
+	piglit_report_result(PIGLIT_PASS);
+}
\ No newline at end of file
-- 
2.17.0



More information about the Piglit mailing list