[Piglit] [PATCH v2 1/2] Add a piglit_require_GL_version() function.
Paul Berry
stereotype441 at gmail.com
Fri Oct 7 17:28:52 PDT 2011
---
tests/util/piglit-util.c | 12 ++++++++++++
tests/util/piglit-util.h | 1 +
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 358b0dc..b8a0219 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -108,6 +108,18 @@ bool piglit_is_extension_supported(const char *name)
return found;
}
+void piglit_require_GL_version(double required_version)
+{
+ double gl_version = strtod((char *) glGetString(GL_VERSION), NULL);
+
+ /* Allow some slop in case of rounding errors */
+ if (gl_version < required_version - 1.0e-5) {
+ printf("Test requires GL version %g\n", required_version);
+ piglit_report_result(PIGLIT_SKIP);
+ exit(1);
+ }
+}
+
void piglit_require_extension(const char *name)
{
if (!piglit_is_extension_supported(name)) {
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 9c3858b..a61ce91 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -130,6 +130,7 @@ void piglit_check_gl_error(GLenum expected_error, enum piglit_result result);
int FindLine(const char *program, int position);
void piglit_report_result(enum piglit_result result);
+void piglit_require_GL_version(double required_version);
void piglit_require_extension(const char *name);
void piglit_require_not_extension(const char *name);
int piglit_probe_pixel_rgb_silent(int x, int y, const float* expected, float *out_probe);
--
1.7.6.4
More information about the Piglit
mailing list