summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2016-07-28 10:49:38 +0100
committerNicolai Hähnle <nicolai.haehnle@amd.com>2016-08-08 13:12:37 +0200
commit19448b2c2cea3d4cae8bb0925ab10346a0c797f8 (patch)
tree3128dcf7313a03c2f6455fb46cf4bf4680820c5b
parent682496dc5714dce5beb6c99285355b12fc8522e7 (diff)
shader_runner: print the line number of test failures
I've found this to be rather useful with longer shader_test scripts. Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
-rw-r--r--tests/shaders/shader_runner.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 583458529..a941d8a18 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -95,6 +95,7 @@ static int gl_max_varying_components;
static int gl_max_clip_planes;
static const char *test_start = NULL;
+static unsigned test_start_line_num = 0;
static GLuint vertex_shaders[256];
static unsigned num_vertex_shaders = 0;
@@ -1120,6 +1121,7 @@ static void
process_test_script(const char *script_name)
{
unsigned text_size;
+ unsigned line_num;
char *text = piglit_load_text_file(script_name, &text_size);
enum states state = none;
const char *line = text;
@@ -1129,6 +1131,8 @@ process_test_script(const char *script_name)
piglit_report_result(PIGLIT_FAIL);
}
+ line_num = 1;
+
while (line[0] != '\0') {
if (line[0] == '[') {
leave_state(state, line);
@@ -1172,6 +1176,7 @@ process_test_script(const char *script_name)
vertex_data_start = NULL;
} else if (string_match("[test]", line)) {
test_start = strchrnul(line, '\n');
+ test_start_line_num = line_num + 1;
if (test_start[0] != '\0')
test_start++;
return;
@@ -1220,6 +1225,8 @@ process_test_script(const char *script_name)
line = strchrnul(line, '\n');
if (line[0] != '\0')
line++;
+
+ line_num++;
}
leave_state(state, line);
@@ -2823,7 +2830,8 @@ enum piglit_result
piglit_display(void)
{
const char *line, *next_line;
- enum piglit_result result = PIGLIT_PASS;
+ unsigned line_num;
+ enum piglit_result full_result = PIGLIT_PASS;
GLbitfield clear_bits = 0;
bool link_error_expected = false;
int ubo_array_index = 0;
@@ -2832,13 +2840,14 @@ piglit_display(void)
return PIGLIT_PASS;
next_line = test_start;
+ line_num = test_start_line_num;
while (next_line[0] != '\0') {
float c[32];
double d[4];
int x, y, z, w, h, l, tex, level;
unsigned ux, uy;
char s[32];
-
+ enum piglit_result result = PIGLIT_PASS;
line = eat_whitespace(next_line);
@@ -3359,6 +3368,13 @@ piglit_display(void)
}
free((void*) line);
+
+ if (result != PIGLIT_PASS) {
+ printf("Test failure on line %u\n", line_num);
+ full_result = result;
+ }
+
+ line_num++;
}
if (!link_ok && !link_error_expected) {
@@ -3383,7 +3399,7 @@ piglit_display(void)
#endif
}
- return result;
+ return full_result;
}