From: Józef Kucia Subject: [PATCH vkd3d 4/6] tests: Introduce VKD3D_TEST_FILTER. Message-Id: <20190717111737.874-4-joseph.kucia@gmail.com> Date: Wed, 17 Jul 2019 13:17:35 +0200 From: Józef Kucia Useful for running a subset of tests. Signed-off-by: Józef Kucia --- README | 4 ++++ include/private/vkd3d_test.h | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/README b/README index 2f2f3952c197..3c70ede80b24 100644 --- a/README +++ b/README @@ -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. diff --git a/include/private/vkd3d_test.h b/include/private/vkd3d_test.h index a37f6ff70ce4..319bf5dc87ea 100644 --- a/include/private/vkd3d_test.h +++ b/include/private/vkd3d_test.h @@ -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(); } -- 2.21.0