[Piglit] [PATCH 1/5] shader_runner: Refactor version comparisons
Ian Romanick
idr at freedesktop.org
Tue Nov 13 17:00:18 PST 2012
From: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
tests/shaders/shader_runner.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index f0037c1..db6a9d4 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -379,6 +379,15 @@ process_comparison(const char *src, enum comparison *cmp)
}
+void
+parse_version_comparison(const char *line, enum comparison *cmp,
+ float *version)
+{
+ line = eat_whitespace(line);
+ line = process_comparison(line, cmp);
+ *version = strtod(line, NULL);
+}
+
/**
* Parse and check a line from the requirement section of the test
*/
@@ -443,9 +452,7 @@ process_requirement(const char *line)
} else if (string_match("GLSL", line)) {
enum comparison cmp;
- line = eat_whitespace(line + 4);
-
- line = process_comparison(line, &cmp);
+ parse_version_comparison(line + 4, &cmp, &glsl_req_version);
/* We only allow >= because we potentially use the
* version number to insert a #version directive. */
@@ -454,7 +461,6 @@ process_requirement(const char *line)
piglit_report_result(PIGLIT_FAIL);
}
- glsl_req_version = strtod(line, NULL);
if (!compare(glsl_req_version, glsl_version, cmp)) {
printf("Test requires GLSL version %s %.1f. "
"Actual version is %.1f.\n",
@@ -467,11 +473,8 @@ process_requirement(const char *line)
enum comparison cmp;
float version;
- line = eat_whitespace(line + 2);
-
- line = process_comparison(line, &cmp);
+ parse_version_comparison(line + 2, &cmp, &version);
- version = strtod(line, NULL);
if (!compare(version, gl_version, cmp)) {
printf("Test requires GL version %s %.1f. "
"Actual version is %.1f.\n",
--
1.7.11.7
More information about the Piglit
mailing list