[Piglit] [PATCH 3/4] util: add file/line info to check_gl_error()

nobled nobled at dreamwidth.org
Sun Apr 22 01:43:04 PDT 2012


---
 tests/util/piglit-util.c |    3 ++-
 tests/util/piglit-util.h |    5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 35a1ffc..6bde4af 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -229,7 +229,7 @@ const char* piglit_get_gl_error_name(GLenum error)
 }

 GLboolean
-piglit_check_gl_error(GLenum expected_error)
+piglit_check_gl_error_(GLenum expected_error, const char *file, unsigned line)
 {
 	GLenum actual_error;

@@ -246,6 +246,7 @@ piglit_check_gl_error(GLenum expected_error)
 	 */
 	printf("Unexpected GL error: %s 0x%x\n",
                piglit_get_gl_error_name(actual_error), actual_error);
+        printf("(Error at %s:%u)\n", file, line);

 	/* Print the expected error, but only if an error was really expected. */
 	if (expected_error != GL_NO_ERROR) {
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 917d798..4c06976 100755
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -187,7 +187,10 @@ const char *piglit_get_gl_enum_name(GLenum param);
  * print a diagnostic and return GL_FALSE.  Otherwise return GL_TRUE.
  */
 GLboolean
-piglit_check_gl_error(GLenum expected_error);
+piglit_check_gl_error_(GLenum expected_error, const char *file, unsigned line);
+
+#define piglit_check_gl_error(expected) \
+ piglit_check_gl_error_((expected), __FILE__, __LINE__)

 /**
  * \brief Drain all GL errors.
-- 
1.7.4.1


More information about the Piglit mailing list