[PATCH v2 0/1] MR499: tests: Print the line number of the probe when a test fails.
Currently, if a probe fails, it will print the line number of the [test] block the probe is in, not the line number of the probe itself. This makes it somewhat difficult to debug. This commit makes it print the line number of the probe as well. CC @zfigura -- v2: tests: Print the line number of the probe when a test fails. https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/499
From: Petrichor Park <ppark(a)codeweavers.com> Currently, if a probe fails, it will print the line number of the [test] block the probe is in, not the line number of the probe itself. This makes it somewhat difficult to debug. This commit makes it print the line number of the probe as well. --- tests/shader_runner.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 0e6104ce3..d821a7571 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -533,7 +533,7 @@ static void read_uint64_t2(const char **line, struct u64vec2 *v) read_uint64(line, &v->y); } -static void parse_test_directive(struct shader_runner *runner, const char *line) +static void parse_test_directive(struct shader_runner *runner, const char *line, unsigned int line_number) { char *rest; int ret; @@ -658,6 +658,8 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) if (runner->last_render_failed) return; + vkd3d_test_push_context("probe line %u", line_number); + if (match_string(line, "uav", &line)) { slot = strtoul(line, &rest, 10); @@ -742,6 +744,7 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) } runner->ops->release_readback(runner, rb); + vkd3d_test_pop_context(); } else if (match_string(line, "uniform", &line)) { @@ -1482,7 +1485,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_o /* Compilation which fails with dxcompiler is not 'todo', therefore the tests are * not 'todo' either. They cannot run, so skip them entirely. */ if (!skip_tests && SUCCEEDED(expect_hr)) - parse_test_directive(runner, line); + parse_test_directive(runner, line, line_number); break; } } -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/499
Right now this prints both the line where the section starts and the line there the `probe` directive here. This feels a bit too much. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/499#note_54072
Honestly it'd probably be sensible to use ok_() to print "whatever.shader_test:123:Test failed" -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/499#note_54130
On Wed Nov 29 11:06:33 2023 +0000, Zebediah Figura wrote:
Honestly it'd probably be sensible to use ok_() to print "whatever.shader_test:123:Test failed" Though notice that, as it is now, `ok_()` only takes the line number, so it prints `shader_runner` instead of `whatever.shader_test`.
-- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/499#note_54230
participants (4)
-
Giovanni Mascellani (@giomasce) -
Petrichor Park -
Petrichor Park (@petrathekat) -
Zebediah Figura (@zfigura)