tests: Report tests skipped because of missing capabilities.

This commit is contained in:
Francisco Casas 2024-08-05 12:58:23 -04:00 committed by Henri Verbeet
parent 84676c378f
commit 2efc79bb81
Notes: Henri Verbeet 2024-08-07 16:01:36 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/987
2 changed files with 57 additions and 24 deletions

View File

@ -1563,10 +1563,8 @@ static enum parse_state read_shader_directive(struct shader_runner *runner, enum
return state; return state;
} }
static bool check_requirements(const struct shader_runner *runner, const struct shader_runner_caps *caps) static bool check_capabilities(const struct shader_runner *runner, const struct shader_runner_caps *caps)
{ {
if (runner->maximum_shader_model < runner->minimum_shader_model)
return false;
if (runner->require_float64 && !caps->float64) if (runner->require_float64 && !caps->float64)
return false; return false;
if (runner->require_int64 && !caps->int64) if (runner->require_int64 && !caps->int64)
@ -1616,6 +1614,13 @@ static void update_line_number_context(const char *testname, unsigned int line_n
vkd3d_test_push_context("%s:%u", testname, line_number); vkd3d_test_push_context("%s:%u", testname, line_number);
} }
enum test_action
{
TEST_ACTION_RUN,
TEST_ACTION_SKIP_SHADER_MODEL,
TEST_ACTION_SKIP_CAPS,
};
void run_shader_tests(struct shader_runner *runner, const struct shader_runner_caps *caps, void run_shader_tests(struct shader_runner *runner, const struct shader_runner_caps *caps,
const struct shader_runner_ops *ops, void *dxc_compiler) const struct shader_runner_ops *ops, void *dxc_compiler)
{ {
@ -1624,9 +1629,9 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
struct sampler *current_sampler = NULL; struct sampler *current_sampler = NULL;
enum parse_state state = STATE_NONE; enum parse_state state = STATE_NONE;
unsigned int i, line_number = 0, block_start_line_number = 0; unsigned int i, line_number = 0, block_start_line_number = 0;
enum test_action test_action = TEST_ACTION_RUN;
char *shader_source = NULL; char *shader_source = NULL;
HRESULT expect_hr = S_OK; HRESULT expect_hr = S_OK;
bool skip_tests = false;
char line_buffer[256]; char line_buffer[256];
const char *testname; const char *testname;
FILE *f; FILE *f;
@ -1682,8 +1687,10 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
break; break;
case STATE_REQUIRE: case STATE_REQUIRE:
if (!check_requirements(runner, caps)) if (runner->maximum_shader_model < runner->minimum_shader_model)
skip_tests = true; test_action = TEST_ACTION_SKIP_SHADER_MODEL;
else if (!check_capabilities(runner, caps))
test_action = TEST_ACTION_SKIP_CAPS;
break; break;
case STATE_RESOURCE: case STATE_RESOURCE:
@ -1693,21 +1700,21 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
/* Not every backend supports every resource type /* Not every backend supports every resource type
* (specifically, D3D9 doesn't support UAVs and * (specifically, D3D9 doesn't support UAVs and
* textures with data type other than float). */ * textures with data type other than float). */
if (!skip_tests) if (test_action == TEST_ACTION_RUN)
{
set_resource(runner, &current_resource); set_resource(runner, &current_resource);
}
free(current_resource.data); free(current_resource.data);
break; break;
case STATE_SHADER_COMPUTE: case STATE_SHADER_COMPUTE:
case STATE_SHADER_COMPUTE_TODO: case STATE_SHADER_COMPUTE_TODO:
if (!skip_tests) if (test_action == TEST_ACTION_RUN)
{ {
todo_if (state == STATE_SHADER_COMPUTE_TODO) todo_if (state == STATE_SHADER_COMPUTE_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_CS, compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_CS,
expect_hr); expect_hr);
} }
if (test_action == TEST_ACTION_SKIP_CAPS)
vkd3d_test_skip(line_number, "Missing capabilities.\n");
free(runner->cs_source); free(runner->cs_source);
runner->cs_source = shader_source; runner->cs_source = shader_source;
shader_source = NULL; shader_source = NULL;
@ -1717,12 +1724,14 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
case STATE_SHADER_PIXEL: case STATE_SHADER_PIXEL:
case STATE_SHADER_PIXEL_TODO: case STATE_SHADER_PIXEL_TODO:
if (!skip_tests) if (test_action == TEST_ACTION_RUN)
{ {
todo_if (state == STATE_SHADER_PIXEL_TODO) todo_if (state == STATE_SHADER_PIXEL_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_PS, compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_PS,
expect_hr); expect_hr);
} }
if (test_action == TEST_ACTION_SKIP_CAPS)
vkd3d_test_skip(line_number, "Missing capabilities.\n");
free(runner->ps_source); free(runner->ps_source);
runner->ps_source = shader_source; runner->ps_source = shader_source;
shader_source = NULL; shader_source = NULL;
@ -1732,12 +1741,14 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
case STATE_SHADER_VERTEX: case STATE_SHADER_VERTEX:
case STATE_SHADER_VERTEX_TODO: case STATE_SHADER_VERTEX_TODO:
if (!skip_tests) if (test_action == TEST_ACTION_RUN)
{ {
todo_if (state == STATE_SHADER_VERTEX_TODO) todo_if (state == STATE_SHADER_VERTEX_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_VS, compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_VS,
expect_hr); expect_hr);
} }
if (test_action == TEST_ACTION_SKIP_CAPS)
vkd3d_test_skip(line_number, "Missing capabilities.\n");
free(runner->vs_source); free(runner->vs_source);
runner->vs_source = shader_source; runner->vs_source = shader_source;
shader_source = NULL; shader_source = NULL;
@ -1747,12 +1758,14 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
case STATE_SHADER_EFFECT: case STATE_SHADER_EFFECT:
case STATE_SHADER_EFFECT_TODO: case STATE_SHADER_EFFECT_TODO:
if (!skip_tests) if (test_action == TEST_ACTION_RUN)
{ {
todo_if (state == STATE_SHADER_EFFECT_TODO) todo_if (state == STATE_SHADER_EFFECT_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_FX, compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_FX,
expect_hr); expect_hr);
} }
if (test_action == TEST_ACTION_SKIP_CAPS)
vkd3d_test_skip(line_number, "Missing capabilities.\n");
free(runner->fx_source); free(runner->fx_source);
runner->fx_source = shader_source; runner->fx_source = shader_source;
shader_source = NULL; shader_source = NULL;
@ -1762,12 +1775,14 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
case STATE_SHADER_HULL: case STATE_SHADER_HULL:
case STATE_SHADER_HULL_TODO: case STATE_SHADER_HULL_TODO:
if (!skip_tests) if (test_action == TEST_ACTION_RUN)
{ {
todo_if (state == STATE_SHADER_HULL_TODO) todo_if (state == STATE_SHADER_HULL_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_HS, compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_HS,
expect_hr); expect_hr);
} }
if (test_action == TEST_ACTION_SKIP_CAPS)
vkd3d_test_skip(line_number, "Missing capabilities.\n");
free(runner->hs_source); free(runner->hs_source);
runner->hs_source = shader_source; runner->hs_source = shader_source;
shader_source = NULL; shader_source = NULL;
@ -1777,12 +1792,14 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
case STATE_SHADER_DOMAIN: case STATE_SHADER_DOMAIN:
case STATE_SHADER_DOMAIN_TODO: case STATE_SHADER_DOMAIN_TODO:
if (!skip_tests) if (test_action == TEST_ACTION_RUN)
{ {
todo_if (state == STATE_SHADER_DOMAIN_TODO) todo_if (state == STATE_SHADER_DOMAIN_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_DS, compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_DS,
expect_hr); expect_hr);
} }
if (test_action == TEST_ACTION_SKIP_CAPS)
vkd3d_test_skip(line_number, "Missing capabilities.\n");
free(runner->ds_source); free(runner->ds_source);
runner->ds_source = shader_source; runner->ds_source = shader_source;
shader_source = NULL; shader_source = NULL;
@ -1792,12 +1809,14 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
case STATE_SHADER_GEOMETRY: case STATE_SHADER_GEOMETRY:
case STATE_SHADER_GEOMETRY_TODO: case STATE_SHADER_GEOMETRY_TODO:
if (!skip_tests) if (test_action == TEST_ACTION_RUN)
{ {
todo_if (state == STATE_SHADER_GEOMETRY_TODO) todo_if (state == STATE_SHADER_GEOMETRY_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_GS, compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_GS,
expect_hr); expect_hr);
} }
if (test_action == TEST_ACTION_SKIP_CAPS)
vkd3d_test_skip(line_number, "Missing capabilities.\n");
free(runner->gs_source); free(runner->gs_source);
runner->gs_source = shader_source; runner->gs_source = shader_source;
shader_source = NULL; shader_source = NULL;
@ -1810,7 +1829,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
ID3D10Blob *blob = NULL, *errors = NULL; ID3D10Blob *blob = NULL, *errors = NULL;
HRESULT hr; HRESULT hr;
if (skip_tests) if (test_action != TEST_ACTION_RUN)
break; break;
hr = D3DPreprocess(shader_source, strlen(shader_source), NULL, NULL, NULL, &blob, &errors); hr = D3DPreprocess(shader_source, strlen(shader_source), NULL, NULL, NULL, &blob, &errors);
@ -1836,7 +1855,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
HRESULT hr; HRESULT hr;
char *text; char *text;
if (skip_tests) if (test_action != TEST_ACTION_RUN)
break; break;
hr = D3DPreprocess(shader_source, strlen(shader_source), NULL, NULL, NULL, &blob, &errors); hr = D3DPreprocess(shader_source, strlen(shader_source), NULL, NULL, NULL, &blob, &errors);
@ -1891,7 +1910,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
runner->require_rov = false; runner->require_rov = false;
runner->require_wave_ops = false; runner->require_wave_ops = false;
runner->compile_options = 0; runner->compile_options = 0;
skip_tests = false; test_action = TEST_ACTION_RUN;
} }
else if (match_directive_substring(line, "[pixel shader", &line)) else if (match_directive_substring(line, "[pixel shader", &line))
{ {
@ -2086,7 +2105,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
case STATE_TEST: case STATE_TEST:
/* Compilation which fails with dxcompiler is not 'todo', therefore the tests are /* Compilation which fails with dxcompiler is not 'todo', therefore the tests are
* not 'todo' either. They cannot run, so skip them entirely. */ * not 'todo' either. They cannot run, so skip them entirely. */
if (!runner->failed_resource_count && !skip_tests && SUCCEEDED(expect_hr)) if (!runner->failed_resource_count && test_action == TEST_ACTION_RUN && SUCCEEDED(expect_hr))
parse_test_directive(runner, line); parse_test_directive(runner, line);
break; break;
} }

View File

@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# test-driver - basic testsuite driver script. Modified for vkd3d tests. # test-driver - basic testsuite driver script. Modified for vkd3d tests.
scriptversion=2022-02-20.01; # UTC scriptversion=2024-08-05.01; # UTC
# This is a modified version of the test_driver script provided by # This is a modified version of the test_driver script provided by
# auto-tools, whose licence is as follows: # auto-tools, whose licence is as follows:
@ -173,6 +173,10 @@ BEGIN {
print "<fade>" $4 "<reset>" "[XP]" print "<fade>" $4 "<reset>" "[XP]"
} }
/: Test skipped:/ {
print "<fade>" $4 "<reset>" "[SK]"
}
/: Assertion .* failed\./ { /: Assertion .* failed\./ {
print "# [AF] <fade>" $0 "<reset>" print "# [AF] <fade>" $0 "<reset>"
} }
@ -198,10 +202,14 @@ fi
# Count number of [XF] tags. # Count number of [XF] tags.
xfcount=$(echo "$details" | awk '/\[XF\]/{count++} END{printf "%d", count}') xfcount=$(echo "$details" | awk '/\[XF\]/{count++} END{printf "%d", count}')
# Count number of [SK] tags.
skcount=$(echo "$details" | awk '/\[SK\]/{count++} END{printf "%d", count}')
details=$(echo "$details" |\ details=$(echo "$details" |\
sed "s/\[F\]/$color_bright_red[F]$color_reset/g" |\ sed "s/\[F\]/$color_bright_red[F]$color_reset/g" |\
sed "s/\[XF\]/$color_yellow[XF]$color_reset/g" |\ sed "s/\[XF\]/$color_yellow[XF]$color_reset/g" |\
sed "s/\[XP\]/$color_dark_red[XP]$color_reset/g" |\ sed "s/\[XP\]/$color_dark_red[XP]$color_reset/g" |\
sed "s/\[SK\]/$color_blue[SK]$color_reset/g" |\
sed "s/\[AF\]/$color_bright_purple[AF]$color_reset/g" |\ sed "s/\[AF\]/$color_bright_purple[AF]$color_reset/g" |\
sed "s/\[SIGABRT\]/$color_bright_purple[SIGABRT]$color_reset/g" |\ sed "s/\[SIGABRT\]/$color_bright_purple[SIGABRT]$color_reset/g" |\
sed "s/\[SIGSEGV\]/$color_bright_purple[SIGSEGV]$color_reset/g" |\ sed "s/\[SIGSEGV\]/$color_bright_purple[SIGSEGV]$color_reset/g" |\
@ -211,9 +219,15 @@ details=$(echo "$details" |\
tr '#' '\n' |\ tr '#' '\n' |\
awk 'NF != 1' ) awk 'NF != 1' )
# If the test passes but has [XF], we will omit details but report number of [XF] # If the test passes, we will omit details but report number of [XF] and [SK]
if [ "$res" = "PASS" ] && [ "$xfcount" -gt 0 ]; then if [ "$res" = "PASS" ]; then
details="$color_yellow($xfcount XF)$color_reset" details=""
if [ "$xfcount" -gt 0 ]; then
details="$details $color_yellow($xfcount XF)$color_reset"
fi
if [ "$skcount" -gt 0 ]; then
details="$details $color_blue($skcount SK)$color_reset"
fi
fi fi
# Report outcome to console. # Report outcome to console.