[Piglit] [PATCH] Replaced assert(glGetError()) with gl_check_gl_error added fail safe conditions

Juliet Fru julietfru at gmail.com
Mon Oct 20 16:41:52 PDT 2014


From: Juliet fru <julietfru at gmail.com>

---
 TODO                                                |  3 ---
 tests/bugs/fdo14575.c                               |  9 ++++++---
 tests/fbo/fbo-1d.c                                  |  6 ++++--
 tests/fbo/fbo-3d.c                                  |  6 ++++--
 tests/fbo/fbo-alpha.c                               |  3 ++-
 tests/fbo/fbo-alphatest-formats.c                   |  3 ++-
 tests/fbo/fbo-alphatest-nocolor-ff.c                |  6 ++++--
 tests/fbo/fbo-alphatest-nocolor.c                   |  6 ++++--
 tests/fbo/fbo-array.c                               |  9 ++++++---
 tests/fbo/fbo-blending-formats.c                    |  3 ++-
 tests/fbo/fbo-blit-d24s8.c                          |  9 ++++++---
 tests/fbo/fbo-blit-stretch.cpp                      |  3 ++-
 tests/fbo/fbo-blit.c                                |  3 ++-
 tests/fbo/fbo-clearmipmap.c                         |  6 ++++--
 tests/fbo/fbo-colormask-formats.c                   |  3 ++-
 tests/fbo/fbo-copypix.c                             |  3 ++-
 tests/fbo/fbo-copyteximage-simple.c                 |  6 ++++--
 tests/fbo/fbo-copyteximage.c                        |  6 ++++--
 tests/fbo/fbo-cubemap.c                             |  6 ++++--
 tests/fbo/fbo-depth-array.c                         | 21 ++++++++++++++-------
 tests/fbo/fbo-depth-sample-compare.c                | 12 ++++++++----
 tests/fbo/fbo-depth-tex1d.c                         |  9 ++++++---
 tests/fbo/fbo-depth.c                               |  3 ++-
 tests/fbo/fbo-depthstencil.c                        |  3 ++-
 tests/fbo/fbo-drawbuffers-arbfp.c                   |  3 ++-
 tests/fbo/fbo-drawbuffers-blend-add.c               |  3 ++-
 tests/fbo/fbo-drawbuffers-fragcolor.c               |  3 ++-
 tests/fbo/fbo-drawbuffers-maxtargets.c              |  3 ++-
 tests/fbo/fbo-drawbuffers.c                         |  3 ++-
 tests/fbo/fbo-drawbuffers2-blend.c                  |  3 ++-
 tests/fbo/fbo-drawbuffers2-colormask.c              |  3 ++-
 tests/fbo/fbo-finish-deleted.c                      |  3 ++-
 tests/fbo/fbo-flushing-2.c                          |  3 ++-
 tests/fbo/fbo-flushing.c                            |  3 ++-
 tests/fbo/fbo-fragcoord.c                           |  9 ++++++---
 tests/fbo/fbo-generatemipmap-array.c                | 18 ++++++++++++------
 tests/fbo/fbo-generatemipmap-formats.c              |  9 ++++++---
 tests/fbo/fbo-generatemipmap-nonsquare.c            |  6 ++++--
 tests/fbo/fbo-generatemipmap-npot.c                 |  6 ++++--
 tests/fbo/fbo-generatemipmap-scissor.c              |  6 ++++--
 tests/fbo/fbo-generatemipmap-swizzle.c              |  6 ++++--
 tests/fbo/fbo-generatemipmap-viewport.c             |  6 ++++--
 tests/fbo/fbo-generatemipmap.c                      |  6 ++++--
 tests/fbo/fbo-luminance-alpha.c                     |  3 ++-
 tests/fbo/fbo-maxsize.c                             |  3 ++-
 tests/fbo/fbo-nodepth-test.c                        |  3 ++-
 tests/fbo/fbo-nostencil-test.c                      |  3 ++-
 tests/fbo/fbo-pbo-readpixels-small.c                |  3 ++-
 tests/fbo/fbo-readdrawpix.c                         |  3 ++-
 tests/fbo/fbo-readpixels-depth-formats.c            |  3 ++-
 tests/fbo/fbo-readpixels.c                          |  3 ++-
 tests/fbo/fbo-rg.c                                  |  6 ++++--
 tests/fbo/fbo-srgb.c                                |  6 ++++--
 tests/fbo/fbo-stencil.c                             |  3 ++-
 tests/fbo/fbo-viewport.c                            |  3 ++-
 tests/general/attribs.c                             |  3 ++-
 tests/general/draw-elements.c                       |  3 ++-
 tests/general/draw-vertices-half-float.c            |  3 ++-
 tests/general/draw-vertices.c                       |  3 ++-
 tests/general/framebuffer-srgb.c                    |  3 ++-
 tests/general/stencil-drawpixels.c                  |  3 ++-
 tests/general/triangle-rasterization-overdraw.cpp   |  3 ++-
 tests/general/triangle-rasterization.cpp            |  6 ++++--
 tests/shaders/glsl-cos.c                            |  3 ++-
 tests/shaders/glsl-fs-discard-02.c                  |  3 ++-
 tests/shaders/glsl-kwin-blur-1.c                    |  3 ++-
 tests/shaders/glsl-kwin-blur-2.c                    |  3 ++-
 tests/shaders/glsl-routing.c                        |  3 ++-
 tests/shaders/glsl-sin.c                            |  3 ++-
 .../arb_draw_elements_base_vertex/negative-index.c  |  3 ++-
 .../arb_es2_compatibility-drawbuffers.c             |  6 ++++--
 tests/spec/arb_framebuffer_srgb/srgb_conformance.c  |  6 ++++--
 tests/spec/arb_map_buffer_range/invalidate.c        |  3 ++-
 .../map_buffer_range_error_check.c                  |  3 ++-
 tests/spec/arb_sampler_objects/framebufferblit.c    |  3 ++-
 .../spec/arb_shader_texture_lod/execution/texgrad.c |  6 ++++--
 .../arb_shader_texture_lod/execution/texgradcube.c  |  6 ++++--
 .../arb_texture_cube_map_array/fbo-cubemap-array.c  |  9 ++++++---
 tests/spec/arb_transform_feedback2/draw-auto.c      |  9 ++++++---
 .../draw-vertices-2101010.c                         |  3 ++-
 tests/spec/ati_draw_buffers/arbfp-no-index.c        |  3 ++-
 tests/spec/ati_draw_buffers/arbfp-no-option.c       |  3 ++-
 tests/spec/ati_draw_buffers/arbfp.c                 |  3 ++-
 .../spec/ext_packed_depth_stencil/readpixels-24_8.c |  3 ++-
 tests/spec/ext_transform_feedback/interleaved.c     |  9 ++++++---
 tests/spec/ext_transform_feedback/output-type.c     | 12 ++++++++----
 tests/spec/ext_transform_feedback/position.c        | 12 ++++++++----
 tests/spec/ext_transform_feedback/separate.c        |  9 ++++++---
 tests/texturing/tex-miplevel-selection.c            | 15 ++++++++++-----
 tests/texturing/texwrap.c                           |  9 ++++++---
 90 files changed, 312 insertions(+), 159 deletions(-)

diff --git a/TODO b/TODO
index fb5c405..eacda79 100644
--- a/TODO
+++ b/TODO
@@ -10,9 +10,6 @@ See https://bugs.freedesktop.org/show_bug.cgi?id=65676 for more details.
 Move/rename tests in the bugs/ directory to proper places under tests/spec/
 
 
-Replace calls such as assert(glGetError() == 0) with piglit_check_gl_error().
-
-
 Quite a few tests have GL enum names encoded in tables.  For example, in
 tests/texturing/texture-rg.c:
 
diff --git a/tests/bugs/fdo14575.c b/tests/bugs/fdo14575.c
index b2f780b..a6125dc 100644
--- a/tests/bugs/fdo14575.c
+++ b/tests/bugs/fdo14575.c
@@ -55,7 +55,8 @@ piglit_init(int argc, char**argv)
 	glBindBufferARB(GL_ARRAY_BUFFER_ARB, buf);
 	glBufferDataARB(GL_ARRAY_BUFFER_ARB, 4, &data, GL_STATIC_DRAW_ARB);
 	glDeleteBuffersARB(1, &buf);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	/* Then, another normal path: create, map, write, unmap, delete */
 	glBindBufferARB(GL_ARRAY_BUFFER_ARB, buf);
@@ -64,7 +65,8 @@ piglit_init(int argc, char**argv)
 	*v = data;
 	glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
 	glDeleteBuffersARB(1, &buf);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	/* Then, do the failing path: create, map, delete */
 	glBindBufferARB(GL_ARRAY_BUFFER_ARB, buf);
@@ -72,7 +74,8 @@ piglit_init(int argc, char**argv)
 	v = (GLfloat *) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
 	*v = data;
 	glDeleteBuffersARB(1, &buf);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	piglit_report_result(PIGLIT_PASS);
 }
diff --git a/tests/fbo/fbo-1d.c b/tests/fbo/fbo-1d.c
index 382febf..63f36be 100644
--- a/tests/fbo/fbo-1d.c
+++ b/tests/fbo/fbo-1d.c
@@ -56,7 +56,8 @@ create_1d_fbo(void)
 		     BUF_WIDTH,
 		     0,
 		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -67,7 +68,8 @@ create_1d_fbo(void)
 				  tex,
 				  0);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-3d.c b/tests/fbo/fbo-3d.c
index 4848f2b..0f0d00a 100644
--- a/tests/fbo/fbo-3d.c
+++ b/tests/fbo/fbo-3d.c
@@ -76,7 +76,8 @@ create_3d_fbo(void)
 		     BUF_WIDTH, BUF_HEIGHT, pot_depth,
 		     0,
 		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -90,7 +91,8 @@ create_3d_fbo(void)
 					  0,
 					  depth);
 
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+			piglit_report_result(PIGLIT_FAIL);
 
 		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-alpha.c b/tests/fbo/fbo-alpha.c
index 48da04c..86e4db5 100644
--- a/tests/fbo/fbo-alpha.c
+++ b/tests/fbo/fbo-alpha.c
@@ -73,7 +73,8 @@ piglit_display(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-alphatest-formats.c b/tests/fbo/fbo-alphatest-formats.c
index a51d66c..cb07f1d 100644
--- a/tests/fbo/fbo-alphatest-formats.c
+++ b/tests/fbo/fbo-alphatest-formats.c
@@ -172,7 +172,8 @@ static enum piglit_result test_format(const struct format_desc *format)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
 	printf("Testing %s", format->name);
diff --git a/tests/fbo/fbo-alphatest-nocolor-ff.c b/tests/fbo/fbo-alphatest-nocolor-ff.c
index e04a626..7528c3d 100644
--- a/tests/fbo/fbo-alphatest-nocolor-ff.c
+++ b/tests/fbo/fbo-alphatest-nocolor-ff.c
@@ -51,7 +51,8 @@ static void create_fbo(GLuint *out_tex)
 	glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
 		     BUF_WIDTH, BUF_WIDTH, 0,
 		     GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	/* Create the FBO. */
 	glGenFramebuffersEXT(1, &fb);
@@ -76,7 +77,8 @@ static void create_fbo(GLuint *out_tex)
 	glClearDepth(0.0);
 	glClear(GL_DEPTH_BUFFER_BIT);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glEnable(GL_ALPHA_TEST);
 	glAlphaFunc(GL_GREATER, 0.5f);
diff --git a/tests/fbo/fbo-alphatest-nocolor.c b/tests/fbo/fbo-alphatest-nocolor.c
index 0294a18..ff7b149 100644
--- a/tests/fbo/fbo-alphatest-nocolor.c
+++ b/tests/fbo/fbo-alphatest-nocolor.c
@@ -66,7 +66,8 @@ static void create_fbo(GLuint *out_tex)
 	glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
 		     BUF_WIDTH, BUF_WIDTH, 0,
 		     GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	/* Create the FBO. */
 	glGenFramebuffersEXT(1, &fb);
@@ -91,7 +92,8 @@ static void create_fbo(GLuint *out_tex)
 	glClearDepth(0.0);
 	glClear(GL_DEPTH_BUFFER_BIT);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glEnable(GL_ALPHA_TEST);
 	glAlphaFunc(GL_GREATER, 0.5f);
diff --git a/tests/fbo/fbo-array.c b/tests/fbo/fbo-array.c
index 6f1e877..9a734ae 100644
--- a/tests/fbo/fbo-array.c
+++ b/tests/fbo/fbo-array.c
@@ -93,14 +93,16 @@ create_array_fbo(void)
 
 	glGenTextures(1, &tex);
 	glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, tex);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	/* allocate empty array texture */
 	glTexImage3D(GL_TEXTURE_2D_ARRAY_EXT, 0, GL_RGBA,
 		     BUF_WIDTH, BUF_HEIGHT, num_layers,
 		     0,
 		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -113,7 +115,8 @@ create_array_fbo(void)
 					     0,
 					     layer);
 
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+			piglit_report_result(PIGLIT_FAIL);
 
 		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-blending-formats.c b/tests/fbo/fbo-blending-formats.c
index 3e6acd2..4632944 100644
--- a/tests/fbo/fbo-blending-formats.c
+++ b/tests/fbo/fbo-blending-formats.c
@@ -280,7 +280,8 @@ static enum piglit_result test_format(const struct format_desc *format)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
 	printf("Testing %s", format->name);
diff --git a/tests/fbo/fbo-blit-d24s8.c b/tests/fbo/fbo-blit-d24s8.c
index dcee918..c0fc772 100644
--- a/tests/fbo/fbo-blit-d24s8.c
+++ b/tests/fbo/fbo-blit-d24s8.c
@@ -81,7 +81,8 @@ make_fbo(int w, int h)
 
 	glDrawBuffer(GL_NONE);
 	glReadBuffer(GL_NONE);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
@@ -229,7 +230,8 @@ run_test(void)
 	     GL_DEPTH_BUFFER_BIT);
 
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	printf("Verify 1\n");
 	pass = verify_depth_rect(PAD, y0, SIZE, SIZE) && pass;
@@ -243,7 +245,8 @@ run_test(void)
 	printf("Verify 5 (FBO)\n");
 	pass = verify_depth_rect(PAD, y1, SIZE, SIZE) && pass;
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	piglit_present_results();
 
diff --git a/tests/fbo/fbo-blit-stretch.cpp b/tests/fbo/fbo-blit-stretch.cpp
index 8235ec4..75c787a 100644
--- a/tests/fbo/fbo-blit-stretch.cpp
+++ b/tests/fbo/fbo-blit-stretch.cpp
@@ -353,7 +353,8 @@ run_test(const TestCase &test)
 			       GL_TEXTURE_2D,
 			       tex,
 			       0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
 	if (status != GL_FRAMEBUFFER_COMPLETE) {
diff --git a/tests/fbo/fbo-blit.c b/tests/fbo/fbo-blit.c
index 79b3020..33963b6 100644
--- a/tests/fbo/fbo-blit.c
+++ b/tests/fbo/fbo-blit.c
@@ -77,7 +77,8 @@ make_fbo(int w, int h)
 				  target,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-clearmipmap.c b/tests/fbo/fbo-clearmipmap.c
index 7b066c0..d26ce0f 100644
--- a/tests/fbo/fbo-clearmipmap.c
+++ b/tests/fbo/fbo-clearmipmap.c
@@ -76,7 +76,8 @@ piglit_init(int argc, char **argv)
 			     0,
 			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glBindTexture(GL_TEXTURE_2D, 0);
 	glDisable(GL_TEXTURE_2D);
@@ -104,7 +105,8 @@ piglit_init(int argc, char **argv)
 			     0.0);
 		glClear(GL_COLOR_BUFFER_BIT);
 
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+			piglit_report_result(PIGLIT_FAIL);
 	}
 done:
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
diff --git a/tests/fbo/fbo-colormask-formats.c b/tests/fbo/fbo-colormask-formats.c
index 2f23d4d..71e6bff 100644
--- a/tests/fbo/fbo-colormask-formats.c
+++ b/tests/fbo/fbo-colormask-formats.c
@@ -145,7 +145,8 @@ static enum piglit_result test_format(const struct format_desc *format)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
 	printf("Testing %s", format->name);
diff --git a/tests/fbo/fbo-copypix.c b/tests/fbo/fbo-copypix.c
index a3ae563..5919d2a 100644
--- a/tests/fbo/fbo-copypix.c
+++ b/tests/fbo/fbo-copypix.c
@@ -72,7 +72,8 @@ make_fbo(int w, int h)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-copyteximage-simple.c b/tests/fbo/fbo-copyteximage-simple.c
index 511b97b..4aefb29 100644
--- a/tests/fbo/fbo-copyteximage-simple.c
+++ b/tests/fbo/fbo-copyteximage-simple.c
@@ -67,7 +67,8 @@ create_fbo(void)
 		     0,
 		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -76,7 +77,8 @@ create_fbo(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-copyteximage.c b/tests/fbo/fbo-copyteximage.c
index e0b47f7..c4a0f3f 100644
--- a/tests/fbo/fbo-copyteximage.c
+++ b/tests/fbo/fbo-copyteximage.c
@@ -68,7 +68,8 @@ create_fbo(void)
 			     0,
 			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	/* Draw into the second level. */
 	glGenFramebuffersEXT(1, &fb);
@@ -78,7 +79,8 @@ create_fbo(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  1);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-cubemap.c b/tests/fbo/fbo-cubemap.c
index 2eb45af..82f5851 100644
--- a/tests/fbo/fbo-cubemap.c
+++ b/tests/fbo/fbo-cubemap.c
@@ -82,7 +82,8 @@ create_cube_fbo(void)
 			level++;
 		}
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -97,7 +98,8 @@ create_cube_fbo(void)
 						  tex,
 						  level);
 
-			assert(glGetError() == 0);
+			if (!piglit_check_gl_error(GL_NO_ERROR))
+				piglit_report_result(PIGLIT_FAIL);
 
 			status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 			if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-depth-array.c b/tests/fbo/fbo-depth-array.c
index 84370e4..d81462b 100644
--- a/tests/fbo/fbo-depth-array.c
+++ b/tests/fbo/fbo-depth-array.c
@@ -225,13 +225,15 @@ create_array_fbo(void)
 
 	glGenTextures(1, &tex);
 	glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	/* allocate empty array texture */
 	glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_DEPTH24_STENCIL8,
 		     width, height, layers, 0,
 		     GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffers(1, &fb);
 	glBindFramebuffer(GL_FRAMEBUFFER, fb);
@@ -271,7 +273,8 @@ create_array_fbo(void)
 					  0,
 					  layer);
 
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+			piglit_report_result(PIGLIT_FAIL);
 
 		status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
 		if (status != GL_FRAMEBUFFER_COMPLETE) {
@@ -347,7 +350,8 @@ create_array_fbo(void)
 
 done:
 	glDeleteFramebuffers(1, &fb);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 	return tex;
 }
 
@@ -385,7 +389,8 @@ draw_layer(int x, int y, int depth)
 			     (double)height / piglit_height * 2,
 			     0, 0, 1, 1);
 	glUseProgram(0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 }
 
 static GLboolean test_layer_drawing(int start_x, int start_y, float expected)
@@ -433,7 +438,8 @@ test_once(void)
 	}
 
 	glDeleteTextures(1, &tex);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 	return pass;
 }
 
@@ -506,5 +512,6 @@ void piglit_init(int argc, char **argv)
 
 	program_fs_empty = piglit_build_simple_program(vs_text,
 					frag_shader_empty_text);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 }
diff --git a/tests/fbo/fbo-depth-sample-compare.c b/tests/fbo/fbo-depth-sample-compare.c
index 72f7d00..6ca0798 100644
--- a/tests/fbo/fbo-depth-sample-compare.c
+++ b/tests/fbo/fbo-depth-sample-compare.c
@@ -83,7 +83,8 @@ create_fbo(void)
    glTexImage2D(TexTarget, 0, depthIntFormat,
                 SIZE, SIZE, 0,
                 GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
-   assert(glGetError() == 0);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+           piglit_report_result(PIGLIT_FAIL);
    glGetTexLevelParameteriv(TexTarget, 0, GL_TEXTURE_DEPTH_SIZE, &Zbits);
 
    /* color texture */
@@ -94,7 +95,8 @@ create_fbo(void)
    glTexImage2D(TexTarget, 0, GL_RGBA,
                 SIZE, SIZE, 0,
                 GL_RGBA, GL_UNSIGNED_BYTE, NULL);
-   assert(glGetError() == 0);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+	    piglit_report_result(PIGLIT_FAIL);
 
    /* Create FBO */
    glGenFramebuffersEXT(1, &FBO);
@@ -112,7 +114,8 @@ create_fbo(void)
                              DepthTex,
                              0);
 
-   assert(glGetError() == 0);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+	    piglit_report_result(PIGLIT_FAIL);
 
    status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
    if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
@@ -315,7 +318,8 @@ show_depth_fbo(void)
 
    glWindowPos2i(SIZE, 0);
    glDrawPixels(SIZE, SIZE, GL_LUMINANCE, GL_FLOAT, zf);
-   assert(glGetError() == 0);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+	    piglit_report_result(PIGLIT_FAIL);
 
 #if DEBUG
    {
diff --git a/tests/fbo/fbo-depth-tex1d.c b/tests/fbo/fbo-depth-tex1d.c
index e4df8ec..51acd9a 100644
--- a/tests/fbo/fbo-depth-tex1d.c
+++ b/tests/fbo/fbo-depth-tex1d.c
@@ -84,13 +84,15 @@ static void create_1d_fbo(GLuint *out_tex, GLuint *out_ds)
 		     BUF_WIDTH,
 		     0,
 		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	/* Create the depth-stencil buffer. */
 	glGenTextures(1, &ds);
 	glBindTexture(GL_TEXTURE_1D, ds);
 	glTexImage1D(GL_TEXTURE_1D, 0, f.iformat, BUF_WIDTH, 0, f.format, f.type, NULL);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	/* Create the FBO. */
 	glGenFramebuffersEXT(1, &fb);
@@ -116,7 +118,8 @@ static void create_1d_fbo(GLuint *out_tex, GLuint *out_ds)
 					  0);
 	}
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-depth.c b/tests/fbo/fbo-depth.c
index 196c51f..28570a1 100644
--- a/tests/fbo/fbo-depth.c
+++ b/tests/fbo/fbo-depth.c
@@ -311,7 +311,8 @@ enum piglit_result piglit_display(void)
 
 	piglit_present_results();
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 	return res;
 }
 
diff --git a/tests/fbo/fbo-depthstencil.c b/tests/fbo/fbo-depthstencil.c
index 43a3080..a4cdb79 100644
--- a/tests/fbo/fbo-depthstencil.c
+++ b/tests/fbo/fbo-depthstencil.c
@@ -480,7 +480,8 @@ enum piglit_result piglit_display(void)
 
 	piglit_present_results();
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 	return res;
 }
 
diff --git a/tests/fbo/fbo-drawbuffers-arbfp.c b/tests/fbo/fbo-drawbuffers-arbfp.c
index e5b2117..a4e6b96 100644
--- a/tests/fbo/fbo-drawbuffers-arbfp.c
+++ b/tests/fbo/fbo-drawbuffers-arbfp.c
@@ -69,7 +69,8 @@ attach_texture(int i)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	return tex;
 }
diff --git a/tests/fbo/fbo-drawbuffers-blend-add.c b/tests/fbo/fbo-drawbuffers-blend-add.c
index b045f23..1ba73df 100644
--- a/tests/fbo/fbo-drawbuffers-blend-add.c
+++ b/tests/fbo/fbo-drawbuffers-blend-add.c
@@ -104,7 +104,8 @@ attach_texture(int i)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	return tex;
 }
diff --git a/tests/fbo/fbo-drawbuffers-fragcolor.c b/tests/fbo/fbo-drawbuffers-fragcolor.c
index 1e75ded..dea5e33 100644
--- a/tests/fbo/fbo-drawbuffers-fragcolor.c
+++ b/tests/fbo/fbo-drawbuffers-fragcolor.c
@@ -77,7 +77,8 @@ attach_texture(int i)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	return tex;
 }
diff --git a/tests/fbo/fbo-drawbuffers-maxtargets.c b/tests/fbo/fbo-drawbuffers-maxtargets.c
index 795d039..8a6014a 100644
--- a/tests/fbo/fbo-drawbuffers-maxtargets.c
+++ b/tests/fbo/fbo-drawbuffers-maxtargets.c
@@ -105,7 +105,8 @@ attach_texture(int i)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	return tex;
 }
diff --git a/tests/fbo/fbo-drawbuffers.c b/tests/fbo/fbo-drawbuffers.c
index 4b72f27..261bcc7 100644
--- a/tests/fbo/fbo-drawbuffers.c
+++ b/tests/fbo/fbo-drawbuffers.c
@@ -61,7 +61,8 @@ attach_texture(int i)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	return tex;
 }
diff --git a/tests/fbo/fbo-drawbuffers2-blend.c b/tests/fbo/fbo-drawbuffers2-blend.c
index 4702137..33d17ec 100644
--- a/tests/fbo/fbo-drawbuffers2-blend.c
+++ b/tests/fbo/fbo-drawbuffers2-blend.c
@@ -60,7 +60,8 @@ attach_texture(int i)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	return tex;
 }
diff --git a/tests/fbo/fbo-drawbuffers2-colormask.c b/tests/fbo/fbo-drawbuffers2-colormask.c
index 84d1ac8..abb7738 100644
--- a/tests/fbo/fbo-drawbuffers2-colormask.c
+++ b/tests/fbo/fbo-drawbuffers2-colormask.c
@@ -62,7 +62,8 @@ attach_texture(int i)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	return tex;
 }
diff --git a/tests/fbo/fbo-finish-deleted.c b/tests/fbo/fbo-finish-deleted.c
index 4895657..42a4ea8 100644
--- a/tests/fbo/fbo-finish-deleted.c
+++ b/tests/fbo/fbo-finish-deleted.c
@@ -72,7 +72,8 @@ void piglit_init(int argc, char **argv)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 	glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
diff --git a/tests/fbo/fbo-flushing-2.c b/tests/fbo/fbo-flushing-2.c
index 011b4d6..bda2308 100644
--- a/tests/fbo/fbo-flushing-2.c
+++ b/tests/fbo/fbo-flushing-2.c
@@ -78,7 +78,8 @@ piglit_display(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	assert(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) ==
 	       GL_FRAMEBUFFER_COMPLETE_EXT);
diff --git a/tests/fbo/fbo-flushing.c b/tests/fbo/fbo-flushing.c
index 8bb1290..07d9c02 100644
--- a/tests/fbo/fbo-flushing.c
+++ b/tests/fbo/fbo-flushing.c
@@ -78,7 +78,8 @@ piglit_display(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	assert(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) ==
 	       GL_FRAMEBUFFER_COMPLETE_EXT);
diff --git a/tests/fbo/fbo-fragcoord.c b/tests/fbo/fbo-fragcoord.c
index e18e24d..6d1befd 100644
--- a/tests/fbo/fbo-fragcoord.c
+++ b/tests/fbo/fbo-fragcoord.c
@@ -57,13 +57,15 @@ create_fbo(unsigned width, unsigned height, GLuint *out_tex)
 		     0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
 	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
 				  GL_TEXTURE_2D, tex, 0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
@@ -121,7 +123,8 @@ piglit_display(void)
 	glDeleteTextures(1, &tex);
 	glDeleteFramebuffersEXT(1, &fb);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	for (y = 0; y < piglit_height; y++) {
 		for (x = 0; x < piglit_width; x++) {
diff --git a/tests/fbo/fbo-generatemipmap-array.c b/tests/fbo/fbo-generatemipmap-array.c
index be3c498..f6d7940 100644
--- a/tests/fbo/fbo-generatemipmap-array.c
+++ b/tests/fbo/fbo-generatemipmap-array.c
@@ -135,14 +135,16 @@ create_array_fbo_1d(void)
 
 	glGenTextures(1, &tex);
 	glBindTexture(GL_TEXTURE_1D_ARRAY_EXT, tex);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	for (i = 0, dim = TEX_WIDTH; dim >0; i++, dim /= 2) {
 		glTexImage2D(GL_TEXTURE_1D_ARRAY_EXT, i, format,
 			     dim, num_layers, 0,
 			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -153,7 +155,8 @@ create_array_fbo_1d(void)
 					  tex,
 					  0,
 					  layer);
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+		        piglit_report_result(PIGLIT_FAIL);
 
 		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
@@ -222,14 +225,16 @@ create_array_fbo_2d(void)
 
 	glGenTextures(1, &tex);
 	glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, tex);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	for (i = 0, dim = TEX_WIDTH; dim >0; i++, dim /= 2) {
 		glTexImage3D(GL_TEXTURE_2D_ARRAY_EXT, i, format,
 			     dim, dim, num_layers, 0,
 			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -240,7 +245,8 @@ create_array_fbo_2d(void)
 					  tex,
 					  0,
 					  layer);
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+		        piglit_report_result(PIGLIT_FAIL);
 
 		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-generatemipmap-formats.c b/tests/fbo/fbo-generatemipmap-formats.c
index 9cb7d4e..d39e354 100644
--- a/tests/fbo/fbo-generatemipmap-formats.c
+++ b/tests/fbo/fbo-generatemipmap-formats.c
@@ -82,7 +82,8 @@ create_tex(GLenum internalformat, GLenum baseformat, GLenum basetype)
 	if ((baseformat == GL_DEPTH_COMPONENT) || (baseformat == GL_DEPTH_STENCIL)) {
 		tex = piglit_depth_texture(GL_TEXTURE_2D, internalformat,
 					   tex_width, tex_height, 1, GL_FALSE);
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+		        piglit_report_result(PIGLIT_FAIL);
 		if (internalformat == GL_DEPTH32F_STENCIL8) {
 			format = GL_DEPTH_STENCIL;
 			type = GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
@@ -117,7 +118,8 @@ create_tex(GLenum internalformat, GLenum baseformat, GLenum basetype)
 			     0,
 			     format, type, NULL);
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenerateMipmapEXT(GL_TEXTURE_2D);
 
@@ -226,7 +228,8 @@ draw_mipmap(int x, int y, int level, GLenum basetype)
 				    b||l||i||d ? 0.5 : 1,
 				    a||i       ? 0.5 : 1);
 		}
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+		        piglit_report_result(PIGLIT_FAIL);
 		break;
 
 	default:
diff --git a/tests/fbo/fbo-generatemipmap-nonsquare.c b/tests/fbo/fbo-generatemipmap-nonsquare.c
index 7a1ec19..49cad86 100644
--- a/tests/fbo/fbo-generatemipmap-nonsquare.c
+++ b/tests/fbo/fbo-generatemipmap-nonsquare.c
@@ -72,7 +72,8 @@ create_fbo(void)
 			     0,
 			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -81,7 +82,8 @@ create_fbo(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-generatemipmap-npot.c b/tests/fbo/fbo-generatemipmap-npot.c
index 6ea8746..6e830f7 100644
--- a/tests/fbo/fbo-generatemipmap-npot.c
+++ b/tests/fbo/fbo-generatemipmap-npot.c
@@ -66,7 +66,8 @@ create_fbo(void)
 			     0,
 			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -75,7 +76,8 @@ create_fbo(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-generatemipmap-scissor.c b/tests/fbo/fbo-generatemipmap-scissor.c
index d08850a..05d38dd 100644
--- a/tests/fbo/fbo-generatemipmap-scissor.c
+++ b/tests/fbo/fbo-generatemipmap-scissor.c
@@ -69,7 +69,8 @@ create_fbo(void)
 			     0,
 			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -78,7 +79,8 @@ create_fbo(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-generatemipmap-swizzle.c b/tests/fbo/fbo-generatemipmap-swizzle.c
index 4b80df4..c3d6a0c 100644
--- a/tests/fbo/fbo-generatemipmap-swizzle.c
+++ b/tests/fbo/fbo-generatemipmap-swizzle.c
@@ -71,7 +71,8 @@ create_fbo(void)
 			     0,
 			     GL_RED, GL_UNSIGNED_BYTE, NULL);
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -80,7 +81,8 @@ create_fbo(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-generatemipmap-viewport.c b/tests/fbo/fbo-generatemipmap-viewport.c
index 4e94d56..95c806f 100644
--- a/tests/fbo/fbo-generatemipmap-viewport.c
+++ b/tests/fbo/fbo-generatemipmap-viewport.c
@@ -68,7 +68,8 @@ create_fbo(void)
 			     0,
 			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -77,7 +78,8 @@ create_fbo(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-generatemipmap.c b/tests/fbo/fbo-generatemipmap.c
index 656b0d4..619db11 100644
--- a/tests/fbo/fbo-generatemipmap.c
+++ b/tests/fbo/fbo-generatemipmap.c
@@ -66,7 +66,8 @@ create_fbo(void)
 			     0,
 			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -75,7 +76,8 @@ create_fbo(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-luminance-alpha.c b/tests/fbo/fbo-luminance-alpha.c
index 8ece653..e68ff6f 100644
--- a/tests/fbo/fbo-luminance-alpha.c
+++ b/tests/fbo/fbo-luminance-alpha.c
@@ -77,7 +77,8 @@ piglit_display(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-maxsize.c b/tests/fbo/fbo-maxsize.c
index 02ce094..64dcd99 100644
--- a/tests/fbo/fbo-maxsize.c
+++ b/tests/fbo/fbo-maxsize.c
@@ -130,7 +130,8 @@ static int create_fbo(void)
 				  GL_COLOR_ATTACHMENT0_EXT,
 				  GL_TEXTURE_2D,
 				  tex, 0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-nodepth-test.c b/tests/fbo/fbo-nodepth-test.c
index 9e86b17..834e1c6 100644
--- a/tests/fbo/fbo-nodepth-test.c
+++ b/tests/fbo/fbo-nodepth-test.c
@@ -65,7 +65,8 @@ piglit_display(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-nostencil-test.c b/tests/fbo/fbo-nostencil-test.c
index 0ca76ba..bf2d4e9 100644
--- a/tests/fbo/fbo-nostencil-test.c
+++ b/tests/fbo/fbo-nostencil-test.c
@@ -65,7 +65,8 @@ piglit_display(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-pbo-readpixels-small.c b/tests/fbo/fbo-pbo-readpixels-small.c
index 919c9fe..c7730b2 100644
--- a/tests/fbo/fbo-pbo-readpixels-small.c
+++ b/tests/fbo/fbo-pbo-readpixels-small.c
@@ -68,7 +68,8 @@ make_fbo(GLuint *fbo, GLuint *tex)
 				  GL_TEXTURE_2D,
 				  *tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-readdrawpix.c b/tests/fbo/fbo-readdrawpix.c
index 7d2e8f8..7a9e0e2 100644
--- a/tests/fbo/fbo-readdrawpix.c
+++ b/tests/fbo/fbo-readdrawpix.c
@@ -72,7 +72,8 @@ make_fbo(int w, int h)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-readpixels-depth-formats.c b/tests/fbo/fbo-readpixels-depth-formats.c
index 8b3fdac..5fbcd54 100644
--- a/tests/fbo/fbo-readpixels-depth-formats.c
+++ b/tests/fbo/fbo-readpixels-depth-formats.c
@@ -185,7 +185,8 @@ test_with_format(GLenum internal_format, const char *name)
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenRenderbuffersEXT(1, &rb);
 	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
diff --git a/tests/fbo/fbo-readpixels.c b/tests/fbo/fbo-readpixels.c
index d70fed0..5339c7f 100644
--- a/tests/fbo/fbo-readpixels.c
+++ b/tests/fbo/fbo-readpixels.c
@@ -87,7 +87,8 @@ test_with_format(GLenum internal_format, GLenum format,
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-rg.c b/tests/fbo/fbo-rg.c
index 58a2de0..ad998c2 100644
--- a/tests/fbo/fbo-rg.c
+++ b/tests/fbo/fbo-rg.c
@@ -108,13 +108,15 @@ create_fbo(unsigned width, unsigned height, GLenum internal_format)
 		     0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
 	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
 				  GL_TEXTURE_2D, tex, 0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/fbo/fbo-srgb.c b/tests/fbo/fbo-srgb.c
index a379d9d..c199801 100644
--- a/tests/fbo/fbo-srgb.c
+++ b/tests/fbo/fbo-srgb.c
@@ -72,7 +72,8 @@ make_fbo(int w, int h, int srgb_format, GLuint *tex_p)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
@@ -123,7 +124,8 @@ framebuffer_srgb_fbo(int srgb_format)
 	fbo = make_fbo(fbo_width, fbo_height, srgb_format, &tex);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glViewport(0, 0, fbo_width, fbo_height);
 	piglit_ortho_projection(fbo_width, fbo_height, GL_FALSE);
diff --git a/tests/fbo/fbo-stencil.c b/tests/fbo/fbo-stencil.c
index 050d761..04d64ea 100644
--- a/tests/fbo/fbo-stencil.c
+++ b/tests/fbo/fbo-stencil.c
@@ -327,7 +327,8 @@ enum piglit_result piglit_display(void)
 
 	piglit_present_results();
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 	return res;
 }
 
diff --git a/tests/fbo/fbo-viewport.c b/tests/fbo/fbo-viewport.c
index d685f36..9602b3d 100644
--- a/tests/fbo/fbo-viewport.c
+++ b/tests/fbo/fbo-viewport.c
@@ -127,7 +127,8 @@ piglit_display(void)
 	glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
 				  GL_RENDERBUFFER, rb);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	assert(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) ==
 			 GL_FRAMEBUFFER_COMPLETE_EXT);
diff --git a/tests/general/attribs.c b/tests/general/attribs.c
index f48d8b9..198f075 100644
--- a/tests/general/attribs.c
+++ b/tests/general/attribs.c
@@ -528,7 +528,8 @@ enum piglit_result piglit_display(void)
 		}
 	}
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 	piglit_present_results();
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
diff --git a/tests/general/draw-elements.c b/tests/general/draw-elements.c
index 0f712c7..0775baf 100644
--- a/tests/general/draw-elements.c
+++ b/tests/general/draw-elements.c
@@ -244,7 +244,8 @@ enum piglit_result
 
 		printf("%s\n", tests[i].name);
 		tests[i].test(x, y, x+20, y+20, tests[i].index);
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+		        piglit_report_result(PIGLIT_FAIL);
 		pass = piglit_probe_pixel_rgb(x+5, y+5, tests[i].expected_color) && pass;
 
 		x += 20;
diff --git a/tests/general/draw-vertices-half-float.c b/tests/general/draw-vertices-half-float.c
index 37f1dc5..499341f 100644
--- a/tests/general/draw-vertices-half-float.c
+++ b/tests/general/draw-vertices-half-float.c
@@ -196,7 +196,8 @@ piglit_display(void)
 
         printf("%s\n", tests[i].name);
         tests[i].test(x, y, x+20, y+20, tests[i].index);
-        assert(glGetError() == 0);
+        if (!piglit_check_gl_error(GL_NO_ERROR))
+		 piglit_report_result(PIGLIT_FAIL);
         pass = piglit_probe_pixel_rgb(x+5, y+5, tests[i].expected_color) && pass;
 
         x += 20;
diff --git a/tests/general/draw-vertices.c b/tests/general/draw-vertices.c
index cd48816..1ddeca8 100644
--- a/tests/general/draw-vertices.c
+++ b/tests/general/draw-vertices.c
@@ -565,7 +565,8 @@ piglit_display(void)
 
         printf("%s\n", tests[i].name);
         tests[i].test(x, y, x+20, y+20, tests[i].index);
-        assert(glGetError() == 0);
+        if (!piglit_check_gl_error(GL_NO_ERROR))
+		 piglit_report_result(PIGLIT_FAIL);
         pass = piglit_probe_pixel_rgb(x+5, y+5, tests[i].expected_color) && pass;
 
         x += 20;
diff --git a/tests/general/framebuffer-srgb.c b/tests/general/framebuffer-srgb.c
index acae0f0..9f88df7 100644
--- a/tests/general/framebuffer-srgb.c
+++ b/tests/general/framebuffer-srgb.c
@@ -244,7 +244,8 @@ make_fbo(int w, int h)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/general/stencil-drawpixels.c b/tests/general/stencil-drawpixels.c
index e04ec9e..1fdc47f 100644
--- a/tests/general/stencil-drawpixels.c
+++ b/tests/general/stencil-drawpixels.c
@@ -91,7 +91,8 @@ piglit_display(void)
 	glColor4fv(blue);
 	piglit_draw_rect(0, 0, piglit_width, piglit_height);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	pass &= piglit_probe_rect_rgb(0, 0, piglit_width, 10, red);
 
diff --git a/tests/general/triangle-rasterization-overdraw.cpp b/tests/general/triangle-rasterization-overdraw.cpp
index 3930303..45ae66a 100644
--- a/tests/general/triangle-rasterization-overdraw.cpp
+++ b/tests/general/triangle-rasterization-overdraw.cpp
@@ -281,7 +281,8 @@ piglit_display(void)
 		piglit_present_results();
 	}
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
diff --git a/tests/general/triangle-rasterization.cpp b/tests/general/triangle-rasterization.cpp
index 0d99ef1..90ae60a 100644
--- a/tests/general/triangle-rasterization.cpp
+++ b/tests/general/triangle-rasterization.cpp
@@ -541,7 +541,8 @@ piglit_display(void)
 					  tex,
 					  0);
 
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+		        piglit_report_result(PIGLIT_FAIL);
 		assert(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT);
 
 		glBindTexture(GL_TEXTURE_2D, 0);
@@ -621,7 +622,8 @@ piglit_display(void)
 		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	}
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
diff --git a/tests/shaders/glsl-cos.c b/tests/shaders/glsl-cos.c
index aebc7a4..ca7beec 100644
--- a/tests/shaders/glsl-cos.c
+++ b/tests/shaders/glsl-cos.c
@@ -86,7 +86,8 @@ static GLboolean test()
         glUniform1f(location, (i - 25) * DEGREES_30);
         piglit_draw_rect((i % 10) * 10, (i / 10) * 10, 10, 10);
     }
-    assert(glGetError() == 0);
+    if (!piglit_check_gl_error(GL_NO_ERROR))
+	     piglit_report_result(PIGLIT_FAIL);
 
     for (i = 0; i <= 50; i++) {
         color[0] = color[1] = cos((i - 25) * DEGREES_30) * 0.5 + 0.5;
diff --git a/tests/shaders/glsl-fs-discard-02.c b/tests/shaders/glsl-fs-discard-02.c
index 2401af5..3277a3e 100644
--- a/tests/shaders/glsl-fs-discard-02.c
+++ b/tests/shaders/glsl-fs-discard-02.c
@@ -95,7 +95,8 @@ static GLboolean test()
 	piglit_draw_rect_z(0.0, -1, -1, 2, 2); // discard
 	piglit_draw_rect_z(0.5, -1, -1, 2, 2); // green
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	pass = pass && piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
 
diff --git a/tests/shaders/glsl-kwin-blur-1.c b/tests/shaders/glsl-kwin-blur-1.c
index dd0fb0d..61ec781 100644
--- a/tests/shaders/glsl-kwin-blur-1.c
+++ b/tests/shaders/glsl-kwin-blur-1.c
@@ -195,7 +195,8 @@ static GLboolean test()
     glDisableClientState(GL_VERTEX_ARRAY);
     glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 
-    assert(glGetError() == 0);
+    if (!piglit_check_gl_error(GL_NO_ERROR))
+	     piglit_report_result(PIGLIT_FAIL);
 
     /* Test the sides */
     for (i = 0; i < 14; i++) {
diff --git a/tests/shaders/glsl-kwin-blur-2.c b/tests/shaders/glsl-kwin-blur-2.c
index 0c03ff8..12d42f3 100644
--- a/tests/shaders/glsl-kwin-blur-2.c
+++ b/tests/shaders/glsl-kwin-blur-2.c
@@ -224,7 +224,8 @@ static GLboolean test()
     glDisableClientState(GL_VERTEX_ARRAY);
     glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 
-    assert(glGetError() == 0);
+    if (!piglit_check_gl_error(GL_NO_ERROR))
+	     piglit_report_result(PIGLIT_FAIL);
 
     /* Test the sides */
     for (i = 0; i < 26; i++) {
diff --git a/tests/shaders/glsl-routing.c b/tests/shaders/glsl-routing.c
index 6bbc439..d01aae6 100644
--- a/tests/shaders/glsl-routing.c
+++ b/tests/shaders/glsl-routing.c
@@ -211,7 +211,8 @@ static GLboolean test(unsigned vsbitmask, unsigned fsbitmask, int line)
             draw_rect(5 + (i*(BOX_SIZE+5)) % 240, 5 + height, i, attrib);
         }
     }
-    assert(glGetError() == 0);
+    if (!piglit_check_gl_error(GL_NO_ERROR))
+	     piglit_report_result(PIGLIT_FAIL);
 
     for (i = 0; i < ATTRIBS; i++) {
         if (((1 << i) & vsbitmask) && ((1 << i) & fsbitmask)) {
diff --git a/tests/shaders/glsl-sin.c b/tests/shaders/glsl-sin.c
index 192b4e2..09ede85 100644
--- a/tests/shaders/glsl-sin.c
+++ b/tests/shaders/glsl-sin.c
@@ -86,7 +86,8 @@ static GLboolean test()
         glUniform1f(location, (i - 25) * DEGREES_30);
         piglit_draw_rect((i % 10) * 10, (i / 10) * 10, 10, 10);
     }
-    assert(glGetError() == 0);
+    if (!piglit_check_gl_error(GL_NO_ERROR))
+	     piglit_report_result(PIGLIT_FAIL);
 
     for (i = 0; i <= 50; i++) {
         color[0] = color[1] = sin((i - 25) * DEGREES_30) * 0.5 + 0.5;
diff --git a/tests/spec/arb_draw_elements_base_vertex/negative-index.c b/tests/spec/arb_draw_elements_base_vertex/negative-index.c
index e0667d3..40e6c40 100644
--- a/tests/spec/arb_draw_elements_base_vertex/negative-index.c
+++ b/tests/spec/arb_draw_elements_base_vertex/negative-index.c
@@ -124,7 +124,8 @@ enum piglit_result piglit_display(void)
 
 		printf("BaseVertex = -%i\n", index);
 		test_negative_index_offset(x, y, x+20, y+20, index);
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+		        piglit_report_result(PIGLIT_FAIL);
 		pass = piglit_probe_pixel_rgb(x+5, y+5, expected) && pass;
 
 		x += 20;
diff --git a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-drawbuffers.c b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-drawbuffers.c
index 0413534..e31aa59 100644
--- a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-drawbuffers.c
+++ b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-drawbuffers.c
@@ -59,7 +59,8 @@ attach_texture(int i)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	return tex;
 }
@@ -106,7 +107,8 @@ piglit_init(int argc, char **argv)
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glDeleteTextures(1, &tex0);
 
diff --git a/tests/spec/arb_framebuffer_srgb/srgb_conformance.c b/tests/spec/arb_framebuffer_srgb/srgb_conformance.c
index 94df797..99018e2 100644
--- a/tests/spec/arb_framebuffer_srgb/srgb_conformance.c
+++ b/tests/spec/arb_framebuffer_srgb/srgb_conformance.c
@@ -94,7 +94,8 @@ static enum piglit_result test_format(void)
 				  GL_TEXTURE_2D,
 				  texfb,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
 	printf("Testing using fb float format");
@@ -162,7 +163,8 @@ static enum piglit_result test_format(void)
 				  texfb,
 				  0);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glEnable(GL_FRAMEBUFFER_SRGB_EXT);
 	status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
diff --git a/tests/spec/arb_map_buffer_range/invalidate.c b/tests/spec/arb_map_buffer_range/invalidate.c
index 8fb3996..a33b367 100644
--- a/tests/spec/arb_map_buffer_range/invalidate.c
+++ b/tests/spec/arb_map_buffer_range/invalidate.c
@@ -236,7 +236,8 @@ enum piglit_result piglit_display(void)
 	}
 
 	glDeleteBuffers(1, &vbo);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 	piglit_present_results();
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
diff --git a/tests/spec/arb_map_buffer_range/map_buffer_range_error_check.c b/tests/spec/arb_map_buffer_range/map_buffer_range_error_check.c
index fabc203..683b253 100644
--- a/tests/spec/arb_map_buffer_range/map_buffer_range_error_check.c
+++ b/tests/spec/arb_map_buffer_range/map_buffer_range_error_check.c
@@ -104,7 +104,8 @@ piglit_init(int argc, char *argv[])
 	 *   (d) GL_MAP_FLUSH_EXPLICIT_BIT is set and GL_MAP_WRITE_BIT is not set.
 	 */
 	glMapBufferRange(target, 0, 10, access);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	/* (a) map again */
 	glMapBufferRange(target, 0, 10, access);
diff --git a/tests/spec/arb_sampler_objects/framebufferblit.c b/tests/spec/arb_sampler_objects/framebufferblit.c
index 10e3625..74348b8 100644
--- a/tests/spec/arb_sampler_objects/framebufferblit.c
+++ b/tests/spec/arb_sampler_objects/framebufferblit.c
@@ -71,7 +71,8 @@ piglit_display(void)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenSamplers(1, &sampler);
 	glSamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
diff --git a/tests/spec/arb_shader_texture_lod/execution/texgrad.c b/tests/spec/arb_shader_texture_lod/execution/texgrad.c
index ec09eda..e1e31bf 100644
--- a/tests/spec/arb_shader_texture_lod/execution/texgrad.c
+++ b/tests/spec/arb_shader_texture_lod/execution/texgrad.c
@@ -99,7 +99,8 @@ void piglit_init(int argc, char **argv)
 			     0,
 			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glBindTexture(GL_TEXTURE_2D, 0);
 	glDisable(GL_TEXTURE_2D);
@@ -126,7 +127,8 @@ void piglit_init(int argc, char **argv)
 			     0.0);
 		glClear(GL_COLOR_BUFFER_BIT);
 
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+		        piglit_report_result(PIGLIT_FAIL);
 	}
 	glDeleteFramebuffersEXT(1, &fb);
 	glBindTexture(GL_TEXTURE_2D, tex);
diff --git a/tests/spec/arb_shader_texture_lod/execution/texgradcube.c b/tests/spec/arb_shader_texture_lod/execution/texgradcube.c
index aeaab48..d0f1e15 100644
--- a/tests/spec/arb_shader_texture_lod/execution/texgradcube.c
+++ b/tests/spec/arb_shader_texture_lod/execution/texgradcube.c
@@ -100,7 +100,8 @@ void piglit_init(int argc, char **argv)
 				     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 		}
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
 	glDisable(GL_TEXTURE_CUBE_MAP);
@@ -128,7 +129,8 @@ void piglit_init(int argc, char **argv)
 				     0.0);
 			glClear(GL_COLOR_BUFFER_BIT);
 
-			assert(glGetError() == 0);
+			if (!piglit_check_gl_error(GL_NO_ERROR))
+		                piglit_report_result(PIGLIT_FAIL);
 		}
 	}
 
diff --git a/tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c b/tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c
index 980eadf..49f6019 100644
--- a/tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c
+++ b/tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c
@@ -99,14 +99,16 @@ create_array_fbo(void)
 
 	glGenTextures(1, &tex);
 	glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY_ARB, tex);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	/* allocate empty array texture */
 	glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY_ARB, 0, GL_RGBA,
 		     BUF_WIDTH, BUF_HEIGHT, num_layers,
 		     0,
 		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
@@ -119,7 +121,8 @@ create_array_fbo(void)
 					     0,
 					     layer);
 
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+		        piglit_report_result(PIGLIT_FAIL);
 
 		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
 		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
diff --git a/tests/spec/arb_transform_feedback2/draw-auto.c b/tests/spec/arb_transform_feedback2/draw-auto.c
index 801abde..933d2c9 100644
--- a/tests/spec/arb_transform_feedback2/draw-auto.c
+++ b/tests/spec/arb_transform_feedback2/draw-auto.c
@@ -119,7 +119,8 @@ void piglit_init(int argc, char **argv)
 	glBindBufferBaseEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, buf);
 	glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glClearColor(0.2, 0.2, 0.2, 1.0);
 	glEnableClientState(GL_VERTEX_ARRAY);
@@ -166,7 +167,8 @@ enum piglit_result piglit_display(void)
 	glEndTransformFeedbackEXT();
 	glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glUseProgram(instanced ? prog_notransform_instanced : prog_notransform);
 	glBindBuffer(GL_ARRAY_BUFFER, buf);
@@ -181,7 +183,8 @@ enum piglit_result piglit_display(void)
 	glDisableClientState(GL_COLOR_ARRAY);
 	glBindBuffer(GL_ARRAY_BUFFER, 0);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	pass = piglit_probe_pixel_rgb(15, 15, red) && pass;
 	pass = piglit_probe_pixel_rgb(35, 15, green) && pass;
diff --git a/tests/spec/arb_vertex_type_2_10_10_10_rev/draw-vertices-2101010.c b/tests/spec/arb_vertex_type_2_10_10_10_rev/draw-vertices-2101010.c
index 2c47372..b848e2b 100644
--- a/tests/spec/arb_vertex_type_2_10_10_10_rev/draw-vertices-2101010.c
+++ b/tests/spec/arb_vertex_type_2_10_10_10_rev/draw-vertices-2101010.c
@@ -226,7 +226,8 @@ piglit_display(void)
 
         printf("%s\n", tests[i].name);
         tests[i].test(x, y, x+20, y+20, tests[i].index);
-        assert(glGetError() == 0);
+        if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
         pass = piglit_probe_pixel_rgba(x+5, y+5, tests[i].expected_color) && pass;
 
         x += 20;
diff --git a/tests/spec/ati_draw_buffers/arbfp-no-index.c b/tests/spec/ati_draw_buffers/arbfp-no-index.c
index 4ca7331..b928cab 100644
--- a/tests/spec/ati_draw_buffers/arbfp-no-index.c
+++ b/tests/spec/ati_draw_buffers/arbfp-no-index.c
@@ -77,7 +77,8 @@ attach_texture(int i)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	return tex;
 }
diff --git a/tests/spec/ati_draw_buffers/arbfp-no-option.c b/tests/spec/ati_draw_buffers/arbfp-no-option.c
index b5202ae..ae062cc 100644
--- a/tests/spec/ati_draw_buffers/arbfp-no-option.c
+++ b/tests/spec/ati_draw_buffers/arbfp-no-option.c
@@ -71,7 +71,8 @@ attach_texture(int i)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	return tex;
 }
diff --git a/tests/spec/ati_draw_buffers/arbfp.c b/tests/spec/ati_draw_buffers/arbfp.c
index 7b25b14..34805c3 100644
--- a/tests/spec/ati_draw_buffers/arbfp.c
+++ b/tests/spec/ati_draw_buffers/arbfp.c
@@ -69,7 +69,8 @@ attach_texture(int i)
 				  GL_TEXTURE_2D,
 				  tex,
 				  0);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	return tex;
 }
diff --git a/tests/spec/ext_packed_depth_stencil/readpixels-24_8.c b/tests/spec/ext_packed_depth_stencil/readpixels-24_8.c
index dd3afc0..7fb9ad8 100644
--- a/tests/spec/ext_packed_depth_stencil/readpixels-24_8.c
+++ b/tests/spec/ext_packed_depth_stencil/readpixels-24_8.c
@@ -80,7 +80,8 @@ test()
 
 	glGenFramebuffersEXT(1, &fb);
 	glBindFramebufferEXT(GL_FRAMEBUFFER, fb);
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenRenderbuffersEXT(1, &rb);
 	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
diff --git a/tests/spec/ext_transform_feedback/interleaved.c b/tests/spec/ext_transform_feedback/interleaved.c
index 8b02fc7..53ed50f 100644
--- a/tests/spec/ext_transform_feedback/interleaved.c
+++ b/tests/spec/ext_transform_feedback/interleaved.c
@@ -98,7 +98,8 @@ void piglit_init(int argc, char **argv)
 	glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT);
 	glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, buf);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glClearColor(0.2, 0.2, 0.2, 1.0);
 	glEnableClientState(GL_VERTEX_ARRAY);
@@ -178,7 +179,8 @@ enum piglit_result piglit_display(void)
 	glEndTransformFeedback();
 	glDisable(GL_RASTERIZER_DISCARD);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	ptr = glMapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, GL_READ_ONLY);
 	for (i = 0; i < BUF_FLOATS; i++) {
@@ -193,7 +195,8 @@ enum piglit_result piglit_display(void)
 	//puts("");
 	glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	piglit_present_results();
 
diff --git a/tests/spec/ext_transform_feedback/output-type.c b/tests/spec/ext_transform_feedback/output-type.c
index 6442d63..88687bf 100644
--- a/tests/spec/ext_transform_feedback/output-type.c
+++ b/tests/spec/ext_transform_feedback/output-type.c
@@ -1525,11 +1525,13 @@ test_ready:
 			     test->num_elements[j]*NUM_VERTICES*sizeof(float),
 			     data, GL_STREAM_READ);
 
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+		        piglit_report_result(PIGLIT_FAIL);
 
 		glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, j, buf[j]);
 
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+		        piglit_report_result(PIGLIT_FAIL);
 
 		free(data);
 	}
@@ -1562,7 +1564,8 @@ enum piglit_result piglit_display(void)
 	glDrawArrays(GL_TRIANGLES, 0, NUM_VERTICES);
 	glEndTransformFeedback();
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	for (j = 0; j < MAX_BUFFERS; j++) {
 		if (!test->num_elements[j]) {
@@ -1594,7 +1597,8 @@ enum piglit_result piglit_display(void)
 			}
 		}
 		glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT);
-		assert(glGetError() == 0);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+		        piglit_report_result(PIGLIT_FAIL);
 	}
 
 	piglit_present_results();
diff --git a/tests/spec/ext_transform_feedback/position.c b/tests/spec/ext_transform_feedback/position.c
index 665ed01..091b44c 100644
--- a/tests/spec/ext_transform_feedback/position.c
+++ b/tests/spec/ext_transform_feedback/position.c
@@ -133,7 +133,8 @@ void piglit_init(int argc, char **argv)
 	glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER_EXT,
 		     BUF_FLOATS*sizeof(float), data, GL_STREAM_READ);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	if (range) {
 		puts("Testing BindBufferRange.");
@@ -154,7 +155,8 @@ void piglit_init(int argc, char **argv)
 		range = MAX_RANGE/2; /* just one primitive is going to be written */
 	}
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glClearColor(0.2, 0.2, 0.2, 1.0);
 	glEnableClientState(GL_VERTEX_ARRAY);
@@ -225,7 +227,8 @@ enum piglit_result piglit_display(void)
 	if (discard)
 		glDisable(GL_RASTERIZER_DISCARD_EXT);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	switch (test) {
 	case READBACK:
@@ -287,7 +290,8 @@ enum piglit_result piglit_display(void)
 	pass = piglit_probe_pixel_rgb(5, 5, clearcolor) && pass;
 	pass = piglit_probe_pixel_rgb(15, 15, discard ? clearcolor : white) && pass;
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	piglit_present_results();
 
diff --git a/tests/spec/ext_transform_feedback/separate.c b/tests/spec/ext_transform_feedback/separate.c
index 7cab4ce..3297d14 100644
--- a/tests/spec/ext_transform_feedback/separate.c
+++ b/tests/spec/ext_transform_feedback/separate.c
@@ -107,7 +107,8 @@ void piglit_init(int argc, char **argv)
 		glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, i, buf[i]);
 	}
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glClearColor(0.2, 0.2, 0.2, 1.0);
 	glEnableClientState(GL_VERTEX_ARRAY);
@@ -139,7 +140,8 @@ enum piglit_result piglit_display(void)
 	glEndTransformFeedback();
 	glDisable(GL_RASTERIZER_DISCARD);
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	pass = piglit_probe_buffer(buf[0], GL_TRANSFORM_FEEDBACK_BUFFER_EXT,
 			"Buffer[0]", NUM_OUT_VERTICES, 3, v3) && pass;
@@ -150,7 +152,8 @@ enum piglit_result piglit_display(void)
 	pass = piglit_probe_buffer(buf[3], GL_TRANSFORM_FEEDBACK_BUFFER_EXT,
 			"Buffer[3]", NUM_OUT_VERTICES, 4, texcoord1) && pass;
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	piglit_present_results();
 
diff --git a/tests/texturing/tex-miplevel-selection.c b/tests/texturing/tex-miplevel-selection.c
index 761f9ae..9b746a4 100644
--- a/tests/texturing/tex-miplevel-selection.c
+++ b/tests/texturing/tex-miplevel-selection.c
@@ -860,7 +860,8 @@ piglit_init(int argc, char **argv)
 	default:
 		assert(0);
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	if (test == FIXED_FUNCTION)
 		glDisable(gltarget);
@@ -900,7 +901,8 @@ piglit_init(int argc, char **argv)
 							  tex, level, layer);
 				break;
 			}
-			assert(glGetError() == 0);
+			if (!piglit_check_gl_error(GL_NO_ERROR))
+				piglit_report_result(PIGLIT_FAIL);
 
 			status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER);
 			if (status != GL_FRAMEBUFFER_COMPLETE) {
@@ -960,7 +962,8 @@ piglit_init(int argc, char **argv)
 				glClear(clearbits);
 			}
 
-			assert(glGetError() == 0);
+			if (!piglit_check_gl_error(GL_NO_ERROR))
+				piglit_report_result(PIGLIT_FAIL);
 		}
 
 		if (gltarget == GL_TEXTURE_RECTANGLE)
@@ -998,7 +1001,8 @@ piglit_init(int argc, char **argv)
 		glSamplerParameteri(samp[1], GL_TEXTURE_COMPARE_FUNC, GL_GREATER);
 	}
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 }
 
 #define SET_VEC(c, x, y, z, w) do { c[0] = x; c[1] = y; c[2] = z; c[3] = w; } while (0)
@@ -1529,7 +1533,8 @@ piglit_display(void)
 	}
 
 end:
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 	printf("Summary: %i/%i passed\n", total-failed, total);
 
 	piglit_present_results();
diff --git a/tests/texturing/texwrap.c b/tests/texturing/texwrap.c
index 82bcf07..88afe4e 100644
--- a/tests/texturing/texwrap.c
+++ b/tests/texturing/texwrap.c
@@ -1146,7 +1146,8 @@ enum piglit_result piglit_display()
 			}
 		}
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
@@ -1635,7 +1636,8 @@ static void init_texture(const struct format_desc *format, GLboolean npot)
 					baseformat, type, (void *) data);
 		break;
 	}
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	if (data != image) {
 		free(data);
@@ -1803,7 +1805,8 @@ outer_continue:;
 	default:;
 	}
 
-	assert(glGetError() == 0);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	if (!piglit_automatic) {
 		piglit_set_keyboard_func(key_func);
-- 
1.9.3



More information about the Piglit mailing list