[Piglit] [PATCH v3 3/5] Add a piglit_require_gl_version() function.

Paul Berry stereotype441 at gmail.com
Thu Oct 13 13:45:35 PDT 2011


---
 tests/util/piglit-util.c |   11 +++++++++++
 tests/util/piglit-util.h |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 026c64e..a78679c 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -105,6 +105,17 @@ bool piglit_is_extension_supported(const char *name)
 	return found;
 }
 
+void piglit_require_gl_version(int required_version_times_10)
+{
+	if (piglit_is_gles() ||
+	    piglit_get_gl_version() < required_version_times_10) {
+		printf("Test requires GL version %g\n",
+		       required_version_times_10 / 10.0);
+		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 2a423c3..67a960d 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -138,6 +138,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(int required_version_times_10);
 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