tests: Introduce VKD3D_TEST_FILTER.

Useful for running a subset of tests.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-07-17 13:17:35 +02:00 committed by Alexandre Julliard
parent 0d851513dc
commit b71120d78d
2 changed files with 10 additions and 0 deletions

4
README
View File

@ -65,6 +65,10 @@ commas or semicolons.
* VKD3D_TEST_DEBUG - enables additional debug messages in tests. Set to 0, 1
or 2.
* VKD3D_TEST_FILTER - a filter string. Only the tests whose names matches the
filter string will be run, e.g. VKD3D_TEST_FILTER=clear_render_target.
Useful for debugging or developing new tests.
* VKD3D_TEST_PLATFORM - can be set to "wine", "windows" or "other". The test
platform controls the behavior of todo(), todo_if(), bug_if() and broken()
conditions in tests.

View File

@ -118,6 +118,7 @@ static struct
bool bug_do_loop;
bool bug_enabled;
const char *test_name_filter;
char context[1024];
} vkd3d_test_state;
@ -254,6 +255,7 @@ vkd3d_test_debug(const char *fmt, ...)
int main(int argc, char **argv)
{
const char *test_filter = getenv("VKD3D_TEST_FILTER");
const char *debug_level = getenv("VKD3D_TEST_DEBUG");
char *test_platform = getenv("VKD3D_TEST_PLATFORM");
const char *bug = getenv("VKD3D_TEST_BUG");
@ -261,6 +263,7 @@ int main(int argc, char **argv)
memset(&vkd3d_test_state, 0, sizeof(vkd3d_test_state));
vkd3d_test_state.debug_level = debug_level ? atoi(debug_level) : 0;
vkd3d_test_state.bug_enabled = bug ? atoi(bug) : true;
vkd3d_test_state.test_name_filter = test_filter;
if (test_platform)
{
@ -341,6 +344,9 @@ typedef void (*vkd3d_test_pfn)(void);
static inline void vkd3d_run_test(const char *name, vkd3d_test_pfn test_pfn)
{
if (vkd3d_test_state.test_name_filter && !strstr(name, vkd3d_test_state.test_name_filter))
return;
vkd3d_test_debug("%s", name);
test_pfn();
}