Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- v2: Get rid of a leftover debug line.
This supersedes patch 168626.
dlls/ddraw/tests/ddraw1.c | 187 +++++++++++++++++++++++++---------- dlls/ddraw/tests/ddraw2.c | 204 ++++++++++++++++++++++++++------------ dlls/ddraw/tests/ddraw4.c | 229 +++++++++++++++++++++++++++++-------------- dlls/ddraw/tests/ddraw7.c | 243 ++++++++++++++++++++++++++++++---------------- 4 files changed, 593 insertions(+), 270 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index cc228028e17..6f5fc64ca83 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -28,6 +28,13 @@
static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *); static DEVMODEW registry_mode; +static BOOL use_mt; + +static struct test_entry +{ + void (*test)(void); +} *mt_tests; +static size_t mt_tests_size, mt_test_count;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
@@ -49,6 +56,63 @@ struct create_window_thread_param HANDLE thread; };
+static void queue_test(void (*test)(void)) +{ + if (mt_test_count >= mt_tests_size) + { + mt_tests_size = max(16, mt_tests_size * 2); + mt_tests = heap_realloc(mt_tests, mt_tests_size * sizeof(*mt_tests)); + } + mt_tests[mt_test_count++].test = test; +} + +static DWORD WINAPI thread_func(void *ctx) +{ + LONG *i = ctx, j; + + while (*i < mt_test_count) + { + j = *i; + if (InterlockedCompareExchange(i, j + 1, j) == j) + mt_tests[j].test(); + } + + return 0; +} + +static void run_queued_tests(void) +{ + unsigned int thread_count, i; + HANDLE *threads; + SYSTEM_INFO si; + LONG test_idx; + + if (!use_mt) + { + for (i = 0; i < mt_test_count; ++i) + { + mt_tests[i].test(); + } + + return; + } + + GetSystemInfo(&si); + thread_count = si.dwNumberOfProcessors; + threads = heap_calloc(thread_count, sizeof(*threads)); + for (i = 0, test_idx = 0; i < thread_count; ++i) + { + threads[i] = CreateThread(NULL, 0, thread_func, &test_idx, 0, NULL); + ok(!!threads[i], "Failed to create thread %u.\n", i); + } + WaitForMultipleObjects(thread_count, threads, TRUE, INFINITE); + for (i = 0; i < thread_count; ++i) + { + CloseHandle(threads[i]); + } + heap_free(threads); +} + static BOOL compare_color(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) { if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; @@ -13069,8 +13133,19 @@ START_TEST(ddraw1) { DDDEVICEIDENTIFIER identifier; DEVMODEW current_mode; + unsigned int argc, i; IDirectDraw *ddraw; HMODULE dwmapi; + char **argv; + + use_mt = !getenv("WINETEST_NO_MT_D3D"); + + argc = winetest_get_mainargs(&argv); + for (i = 2; i < argc; ++i) + { + if (!strcmp(argv[i], "--single")) + use_mt = FALSE; + }
if (!(ddraw = create_ddraw())) { @@ -13103,78 +13178,84 @@ START_TEST(ddraw1) if ((dwmapi = LoadLibraryA("dwmapi.dll"))) pDwmIsCompositionEnabled = (void *)GetProcAddress(dwmapi, "DwmIsCompositionEnabled");
+ queue_test(test_clipper_blt); + queue_test(test_surface_interface_mismatch); + queue_test(test_viewport_object); + queue_test(test_zenable); + queue_test(test_ck_rgba); + queue_test(test_ck_default); + queue_test(test_surface_qi); + queue_test(test_device_qi); + queue_test(test_initialize); + queue_test(test_coop_level_surf_create); + queue_test(test_coop_level_multi_window); + queue_test(test_clear_rect_count); + queue_test(test_unsupported_formats); + queue_test(test_rt_caps); + queue_test(test_surface_lock); + queue_test(test_surface_discard); + queue_test(test_sysmem_overlay); + queue_test(test_pixel_format); + queue_test(test_create_surface_pitch); + queue_test(test_mipmap); + queue_test(test_palette_complex); + queue_test(test_p8_blit); + queue_test(test_material); + queue_test(test_lighting); + queue_test(test_specular_lighting); + queue_test(test_surface_desc_lock); + queue_test(test_texturemapblend); + queue_test(test_viewport_clear_rect); + queue_test(test_color_fill); + queue_test(test_range_colorkey); + queue_test(test_shademode); + queue_test(test_lockrect_invalid); + queue_test(test_yv12_overlay); + queue_test(test_overlay_rect); + queue_test(test_blt); + queue_test(test_blt_z_alpha); + queue_test(test_getdc); + queue_test(test_transform_vertices); + queue_test(test_surface_desc_size); + queue_test(test_texture_load); + queue_test(test_ck_operation); + queue_test(test_depth_readback); + queue_test(test_clear); + queue_test(test_enum_surfaces); + queue_test(test_execute_data); + queue_test(test_viewport); + queue_test(test_find_device); + queue_test(test_alphatest); + queue_test(test_clipper_refcount); + queue_test(test_d32_support); + + run_queued_tests(); + + /* These tests don't work reliably when run in parallel. */ + test_colorkey_precision(); + test_offscreen_overlay(); + test_caps(); + /* These tests use full-screen/exclusive mode, so shouldn't run in + * parallel. */ test_coop_level_create_device_window(); - test_clipper_blt(); test_coop_level_d3d_state(); - test_surface_interface_mismatch(); test_coop_level_threaded(); - test_viewport_object(); - test_zenable(); - test_ck_rgba(); - test_ck_default(); test_ck_complex(); - test_surface_qi(); - test_device_qi(); test_wndproc(); test_window_style(); test_redundant_mode_set(); test_coop_level_mode_set(); test_coop_level_mode_set_multi(); - test_initialize(); - test_coop_level_surf_create(); - test_coop_level_multi_window(); - test_clear_rect_count(); test_coop_level_activateapp(); - test_unsupported_formats(); - test_rt_caps(); test_primary_caps(); - test_surface_lock(); - test_surface_discard(); test_flip(); - test_sysmem_overlay(); test_primary_palette(); test_surface_attachment(); - test_pixel_format(); - test_create_surface_pitch(); - test_mipmap(); - test_palette_complex(); - test_p8_blit(); - test_material(); - test_lighting(); - test_specular_lighting(); test_palette_gdi(); test_palette_alpha(); test_lost_device(); - test_surface_desc_lock(); - test_texturemapblend(); - test_viewport_clear_rect(); - test_color_fill(); - test_colorkey_precision(); - test_range_colorkey(); - test_shademode(); - test_lockrect_invalid(); - test_yv12_overlay(); - test_offscreen_overlay(); - test_overlay_rect(); - test_blt(); - test_blt_z_alpha(); test_cross_device_blt(); - test_getdc(); - test_transform_vertices(); test_display_mode_surface_pixel_format(); - test_surface_desc_size(); - test_texture_load(); - test_ck_operation(); - test_depth_readback(); - test_clear(); - test_enum_surfaces(); - test_execute_data(); - test_viewport(); - test_find_device(); test_killfocus(); test_gdi_surface(); - test_alphatest(); - test_clipper_refcount(); - test_caps(); - test_d32_support(); } diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 595157b486f..bf1c99e501f 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -17,11 +17,10 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ - -#include <math.h> - #define COBJMACROS + #include "wine/test.h" +#include "wine/heap.h" #include <limits.h> #include <math.h> #include "ddrawi.h" @@ -29,6 +28,13 @@
static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *); static DEVMODEW registry_mode; +static BOOL use_mt; + +static struct test_entry +{ + void (*test)(void); +} *mt_tests; +static size_t mt_tests_size, mt_test_count;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
@@ -50,6 +56,63 @@ struct create_window_thread_param HANDLE thread; };
+static void queue_test(void (*test)(void)) +{ + if (mt_test_count >= mt_tests_size) + { + mt_tests_size = max(16, mt_tests_size * 2); + mt_tests = heap_realloc(mt_tests, mt_tests_size * sizeof(*mt_tests)); + } + mt_tests[mt_test_count++].test = test; +} + +static DWORD WINAPI thread_func(void *ctx) +{ + LONG *i = ctx, j; + + while (*i < mt_test_count) + { + j = *i; + if (InterlockedCompareExchange(i, j + 1, j) == j) + mt_tests[j].test(); + } + + return 0; +} + +static void run_queued_tests(void) +{ + unsigned int thread_count, i; + HANDLE *threads; + SYSTEM_INFO si; + LONG test_idx; + + if (!use_mt) + { + for (i = 0; i < mt_test_count; ++i) + { + mt_tests[i].test(); + } + + return; + } + + GetSystemInfo(&si); + thread_count = si.dwNumberOfProcessors; + threads = heap_calloc(thread_count, sizeof(*threads)); + for (i = 0, test_idx = 0; i < thread_count; ++i) + { + threads[i] = CreateThread(NULL, 0, thread_func, &test_idx, 0, NULL); + ok(!!threads[i], "Failed to create thread %u.\n", i); + } + WaitForMultipleObjects(thread_count, threads, TRUE, INFINITE); + for (i = 0; i < thread_count; ++i) + { + CloseHandle(threads[i]); + } + heap_free(threads); +} + static BOOL compare_color(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) { if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; @@ -13953,8 +14016,19 @@ START_TEST(ddraw2) { DDDEVICEIDENTIFIER identifier; DEVMODEW current_mode; + unsigned int argc, i; IDirectDraw2 *ddraw; HMODULE dwmapi; + char **argv; + + use_mt = !getenv("WINETEST_NO_MT_D3D"); + + argc = winetest_get_mainargs(&argv); + for (i = 2; i < argc; ++i) + { + if (!strcmp(argv[i], "--single")) + use_mt = FALSE; + }
if (!(ddraw = create_ddraw())) { @@ -13987,85 +14061,91 @@ START_TEST(ddraw2) if ((dwmapi = LoadLibraryA("dwmapi.dll"))) pDwmIsCompositionEnabled = (void *)GetProcAddress(dwmapi, "DwmIsCompositionEnabled");
+ queue_test(test_clipper_blt); + queue_test(test_surface_interface_mismatch); + queue_test(test_depth_blit); + queue_test(test_texture_load_ckey); + queue_test(test_viewport_object); + queue_test(test_zenable); + queue_test(test_ck_rgba); + queue_test(test_ck_default); + queue_test(test_surface_qi); + queue_test(test_device_qi); + queue_test(test_initialize); + queue_test(test_coop_level_surf_create); + queue_test(test_coop_level_multi_window); + queue_test(test_clear_rect_count); + queue_test(test_lighting_interface_versions); + queue_test(test_unsupported_formats); + queue_test(test_rt_caps); + queue_test(test_surface_lock); + queue_test(test_surface_discard); + queue_test(test_set_surface_desc); + queue_test(test_user_memory_getdc); + queue_test(test_sysmem_overlay); + queue_test(test_pixel_format); + queue_test(test_create_surface_pitch); + queue_test(test_mipmap); + queue_test(test_palette_complex); + queue_test(test_p8_blit); + queue_test(test_material); + queue_test(test_lighting); + queue_test(test_specular_lighting); + queue_test(test_surface_desc_lock); + queue_test(test_texturemapblend); + queue_test(test_viewport_clear_rect); + queue_test(test_color_fill); + queue_test(test_range_colorkey); + queue_test(test_shademode); + queue_test(test_lockrect_invalid); + queue_test(test_yv12_overlay); + queue_test(test_overlay_rect); + queue_test(test_blt); + queue_test(test_blt_z_alpha); + queue_test(test_getdc); + queue_test(test_draw_primitive); + queue_test(test_edge_antialiasing_blending); + queue_test(test_transform_vertices); + queue_test(test_surface_desc_size); + queue_test(test_ck_operation); + queue_test(test_set_render_state); + queue_test(test_depth_readback); + queue_test(test_clear); + queue_test(test_enum_surfaces); + queue_test(test_viewport); + queue_test(test_find_device); + queue_test(test_alphatest); + queue_test(test_clipper_refcount); + queue_test(test_d32_support); + + run_queued_tests(); + + /* These tests don't work reliably when run in parallel. */ + test_colorkey_precision(); + test_offscreen_overlay(); + test_caps(); + /* These tests use full-screen/exclusive mode, so shouldn't run in + * parallel. */ test_coop_level_create_device_window(); - test_clipper_blt(); test_coop_level_d3d_state(); - test_surface_interface_mismatch(); test_coop_level_threaded(); - test_depth_blit(); - test_texture_load_ckey(); - test_viewport_object(); - test_zenable(); - test_ck_rgba(); - test_ck_default(); test_ck_complex(); - test_surface_qi(); - test_device_qi(); test_wndproc(); test_window_style(); test_redundant_mode_set(); test_coop_level_mode_set(); test_coop_level_mode_set_multi(); - test_initialize(); - test_coop_level_surf_create(); - test_coop_level_multi_window(); - test_clear_rect_count(); test_coop_level_versions(); - test_lighting_interface_versions(); test_coop_level_activateapp(); - test_unsupported_formats(); - test_rt_caps(); test_primary_caps(); - test_surface_lock(); - test_surface_discard(); test_flip(); - test_set_surface_desc(); - test_user_memory_getdc(); - test_sysmem_overlay(); test_primary_palette(); test_surface_attachment(); - test_pixel_format(); - test_create_surface_pitch(); - test_mipmap(); - test_palette_complex(); - test_p8_blit(); - test_material(); - test_lighting(); - test_specular_lighting(); test_palette_gdi(); test_palette_alpha(); test_lost_device(); - test_surface_desc_lock(); - test_texturemapblend(); - test_viewport_clear_rect(); - test_color_fill(); - test_colorkey_precision(); - test_range_colorkey(); - test_shademode(); - test_lockrect_invalid(); - test_yv12_overlay(); - test_offscreen_overlay(); - test_overlay_rect(); - test_blt(); - test_blt_z_alpha(); test_cross_device_blt(); - test_getdc(); - test_draw_primitive(); - test_edge_antialiasing_blending(); - test_transform_vertices(); test_display_mode_surface_pixel_format(); - test_surface_desc_size(); - test_ck_operation(); - test_set_render_state(); - test_depth_readback(); - test_clear(); - test_enum_surfaces(); - test_viewport(); - test_find_device(); test_killfocus(); test_gdi_surface(); - test_alphatest(); - test_clipper_refcount(); - test_caps(); - test_d32_support(); } diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 567a8f38c01..4cb67421722 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -30,6 +30,13 @@ HRESULT WINAPI GetSurfaceFromDC(HDC dc, struct IDirectDrawSurface **surface, HDC
static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *); static DEVMODEW registry_mode; +static BOOL use_mt; + +static struct test_entry +{ + void (*test)(void); +} *mt_tests; +static size_t mt_tests_size, mt_test_count;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
@@ -56,6 +63,63 @@ struct create_window_thread_param HANDLE thread; };
+static void queue_test(void (*test)(void)) +{ + if (mt_test_count >= mt_tests_size) + { + mt_tests_size = max(16, mt_tests_size * 2); + mt_tests = heap_realloc(mt_tests, mt_tests_size * sizeof(*mt_tests)); + } + mt_tests[mt_test_count++].test = test; +} + +static DWORD WINAPI thread_func(void *ctx) +{ + LONG *i = ctx, j; + + while (*i < mt_test_count) + { + j = *i; + if (InterlockedCompareExchange(i, j + 1, j) == j) + mt_tests[j].test(); + } + + return 0; +} + +static void run_queued_tests(void) +{ + unsigned int thread_count, i; + HANDLE *threads; + SYSTEM_INFO si; + LONG test_idx; + + if (!use_mt) + { + for (i = 0; i < mt_test_count; ++i) + { + mt_tests[i].test(); + } + + return; + } + + GetSystemInfo(&si); + thread_count = si.dwNumberOfProcessors; + threads = heap_calloc(thread_count, sizeof(*threads)); + for (i = 0, test_idx = 0; i < thread_count; ++i) + { + threads[i] = CreateThread(NULL, 0, thread_func, &test_idx, 0, NULL); + ok(!!threads[i], "Failed to create thread %u.\n", i); + } + WaitForMultipleObjects(thread_count, threads, TRUE, INFINITE); + for (i = 0; i < thread_count; ++i) + { + CloseHandle(threads[i]); + } + heap_free(threads); +} + static BOOL compare_float(float f, float g, unsigned int ulps) { int x = *(int *)&f; @@ -16508,8 +16572,19 @@ START_TEST(ddraw4) { DDDEVICEIDENTIFIER identifier; DEVMODEW current_mode; + unsigned int argc, i; IDirectDraw4 *ddraw; HMODULE dwmapi; + char **argv; + + use_mt = !getenv("WINETEST_NO_MT_D3D"); + + argc = winetest_get_mainargs(&argv); + for (i = 2; i < argc; ++i) + { + if (!strcmp(argv[i], "--single")) + use_mt = FALSE; + }
if (!(ddraw = create_ddraw())) { @@ -16542,100 +16617,106 @@ START_TEST(ddraw4) if ((dwmapi = LoadLibraryA("dwmapi.dll"))) pDwmIsCompositionEnabled = (void *)GetProcAddress(dwmapi, "DwmIsCompositionEnabled");
- test_process_vertices(); + queue_test(test_process_vertices); + queue_test(test_clipper_blt); + queue_test(test_surface_interface_mismatch); + queue_test(test_depth_blit); + queue_test(test_texture_load_ckey); + queue_test(test_viewport_object); + queue_test(test_zenable); + queue_test(test_ck_rgba); + queue_test(test_ck_default); + queue_test(test_surface_qi); + queue_test(test_device_qi); + queue_test(test_initialize); + queue_test(test_coop_level_surf_create); + queue_test(test_vb_discard); + queue_test(test_coop_level_multi_window); + queue_test(test_draw_strided); + queue_test(test_lighting); + queue_test(test_specular_lighting); + queue_test(test_clear_rect_count); + queue_test(test_lighting_interface_versions); + queue_test(test_texturemanage); + queue_test(test_block_formats_creation); + queue_test(test_unsupported_formats); + queue_test(test_rt_caps); + queue_test(test_surface_lock); + queue_test(test_surface_discard); + queue_test(test_set_surface_desc); + queue_test(test_user_memory_getdc); + queue_test(test_sysmem_overlay); + queue_test(test_private_data); + queue_test(test_pixel_format); + queue_test(test_create_surface_pitch); + queue_test(test_mipmap); + queue_test(test_palette_complex); + queue_test(test_p8_blit); + queue_test(test_material); + queue_test(test_vb_writeonly); + queue_test(test_surface_desc_lock); + queue_test(test_texturemapblend); + queue_test(test_signed_formats); + queue_test(test_color_fill); + queue_test(test_texcoordindex); + queue_test(test_range_colorkey); + queue_test(test_shademode); + queue_test(test_lockrect_invalid); + queue_test(test_yv12_overlay); + queue_test(test_overlay_rect); + queue_test(test_blt); + queue_test(test_blt_z_alpha); + queue_test(test_color_clamping); + queue_test(test_getdc); + queue_test(test_draw_primitive); + queue_test(test_edge_antialiasing_blending); + queue_test(test_transform_vertices); + queue_test(test_surface_desc_size); + queue_test(test_get_surface_from_dc); + queue_test(test_ck_operation); + queue_test(test_vb_refcount); + queue_test(test_compute_sphere_visibility); + queue_test(test_texture_stages_limits); + queue_test(test_set_render_state); + queue_test(test_depth_readback); + queue_test(test_clear); + queue_test(test_enum_surfaces); + queue_test(test_viewport); + queue_test(test_find_device); + queue_test(test_sysmem_draw); + queue_test(test_alphatest); + queue_test(test_clipper_refcount); + queue_test(test_d32_support); + + run_queued_tests(); + + /* These tests don't work reliably when run in parallel. */ + test_colorkey_precision(); + test_offscreen_overlay(); + test_map_synchronisation(); + test_caps(); + /* These tests use full-screen/exclusive mode, so shouldn't run in + * parallel. */ test_coop_level_create_device_window(); - test_clipper_blt(); test_coop_level_d3d_state(); - test_surface_interface_mismatch(); test_coop_level_threaded(); - test_depth_blit(); - test_texture_load_ckey(); - test_viewport_object(); - test_zenable(); - test_ck_rgba(); - test_ck_default(); test_ck_complex(); - test_surface_qi(); - test_device_qi(); test_wndproc(); test_window_style(); test_redundant_mode_set(); test_coop_level_mode_set(); test_coop_level_mode_set_multi(); - test_initialize(); - test_coop_level_surf_create(); - test_vb_discard(); - test_coop_level_multi_window(); - test_draw_strided(); - test_lighting(); - test_specular_lighting(); - test_clear_rect_count(); test_coop_level_versions(); - test_lighting_interface_versions(); test_coop_level_activateapp(); - test_texturemanage(); - test_block_formats_creation(); - test_unsupported_formats(); - test_rt_caps(); test_primary_caps(); - test_surface_lock(); - test_surface_discard(); test_flip(); - test_set_surface_desc(); - test_user_memory_getdc(); - test_sysmem_overlay(); test_primary_palette(); test_surface_attachment(); - test_private_data(); - test_pixel_format(); - test_create_surface_pitch(); - test_mipmap(); - test_palette_complex(); - test_p8_blit(); - test_material(); test_palette_gdi(); test_palette_alpha(); - test_vb_writeonly(); test_lost_device(); - test_surface_desc_lock(); - test_texturemapblend(); - test_signed_formats(); - test_color_fill(); - test_texcoordindex(); - test_colorkey_precision(); - test_range_colorkey(); - test_shademode(); - test_lockrect_invalid(); - test_yv12_overlay(); - test_offscreen_overlay(); - test_overlay_rect(); - test_blt(); - test_blt_z_alpha(); test_cross_device_blt(); - test_color_clamping(); - test_getdc(); - test_draw_primitive(); - test_edge_antialiasing_blending(); - test_transform_vertices(); test_display_mode_surface_pixel_format(); - test_surface_desc_size(); - test_get_surface_from_dc(); - test_ck_operation(); - test_vb_refcount(); - test_compute_sphere_visibility(); - test_texture_stages_limits(); - test_set_render_state(); - test_map_synchronisation(); - test_depth_readback(); - test_clear(); - test_enum_surfaces(); - test_viewport(); - test_find_device(); test_killfocus(); - test_sysmem_draw(); test_gdi_surface(); - test_alphatest(); - test_clipper_refcount(); - test_caps(); - test_d32_support(); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 116e34a1768..b5601bcc118 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -30,6 +30,13 @@ HRESULT WINAPI GetSurfaceFromDC(HDC dc, struct IDirectDrawSurface **surface, HDC static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID *guid, void **ddraw, REFIID iid, IUnknown *outer_unknown); static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *); static DEVMODEW registry_mode; +static BOOL use_mt; + +static struct test_entry +{ + void (*test)(void); +} *mt_tests; +static size_t mt_tests_size, mt_test_count;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
@@ -56,6 +63,63 @@ struct create_window_thread_param HANDLE thread; };
+static void queue_test(void (*test)(void)) +{ + if (mt_test_count >= mt_tests_size) + { + mt_tests_size = max(16, mt_tests_size * 2); + mt_tests = heap_realloc(mt_tests, mt_tests_size * sizeof(*mt_tests)); + } + mt_tests[mt_test_count++].test = test; +} + +static DWORD WINAPI thread_func(void *ctx) +{ + LONG *i = ctx, j; + + while (*i < mt_test_count) + { + j = *i; + if (InterlockedCompareExchange(i, j + 1, j) == j) + mt_tests[j].test(); + } + + return 0; +} + +static void run_queued_tests(void) +{ + unsigned int thread_count, i; + HANDLE *threads; + SYSTEM_INFO si; + LONG test_idx; + + if (!use_mt) + { + for (i = 0; i < mt_test_count; ++i) + { + mt_tests[i].test(); + } + + return; + } + + GetSystemInfo(&si); + thread_count = si.dwNumberOfProcessors; + threads = heap_calloc(thread_count, sizeof(*threads)); + for (i = 0, test_idx = 0; i < thread_count; ++i) + { + threads[i] = CreateThread(NULL, 0, thread_func, &test_idx, 0, NULL); + ok(!!threads[i], "Failed to create thread %u.\n", i); + } + WaitForMultipleObjects(thread_count, threads, TRUE, INFINITE); + for (i = 0; i < thread_count; ++i) + { + CloseHandle(threads[i]); + } + heap_free(threads); +} + static BOOL compare_float(float f, float g, unsigned int ulps) { int x = *(int *)&f; @@ -16480,7 +16544,18 @@ START_TEST(ddraw7) DDDEVICEIDENTIFIER2 identifier; HMODULE module, dwmapi; DEVMODEW current_mode; + unsigned int argc, i; IDirectDraw7 *ddraw; + char **argv; + + use_mt = !getenv("WINETEST_NO_MT_D3D"); + + argc = winetest_get_mainargs(&argv); + for (i = 2; i < argc; ++i) + { + if (!strcmp(argv[i], "--single")) + use_mt = FALSE; + }
module = GetModuleHandleA("ddraw.dll"); if (!(pDirectDrawCreateEx = (void *)GetProcAddress(module, "DirectDrawCreateEx"))) @@ -16520,107 +16595,113 @@ START_TEST(ddraw7) if ((dwmapi = LoadLibraryA("dwmapi.dll"))) pDwmIsCompositionEnabled = (void *)GetProcAddress(dwmapi, "DwmIsCompositionEnabled");
- test_process_vertices(); + queue_test(test_process_vertices); + queue_test(test_clipper_blt); + queue_test(test_surface_interface_mismatch); + queue_test(test_depth_blit); + queue_test(test_texture_load_ckey); + queue_test(test_zenable); + queue_test(test_ck_rgba); + queue_test(test_ck_default); + queue_test(test_surface_qi); + queue_test(test_device_qi); + queue_test(test_initialize); + queue_test(test_coop_level_surf_create); + queue_test(test_vb_discard); + queue_test(test_coop_level_multi_window); + queue_test(test_draw_strided); + queue_test(test_lighting); + queue_test(test_specular_lighting); + queue_test(test_clear_rect_count); + queue_test(test_fog_special); + queue_test(test_lighting_interface_versions); + queue_test(test_texturemanage); + queue_test(test_block_formats_creation); + queue_test(test_unsupported_formats); + queue_test(test_rt_caps); + queue_test(test_surface_lock); + queue_test(test_surface_discard); + queue_test(test_set_surface_desc); + queue_test(test_user_memory_getdc); + queue_test(test_sysmem_overlay); + queue_test(test_private_data); + queue_test(test_pixel_format); + queue_test(test_create_surface_pitch); + queue_test(test_mipmap); + queue_test(test_palette_complex); + queue_test(test_p8_blit); + queue_test(test_material); + queue_test(test_vb_writeonly); + queue_test(test_resource_priority); + queue_test(test_surface_desc_lock); + queue_test(test_fog_interpolation); + queue_test(test_fog_process_vertices); + queue_test(test_negative_fixedfunction_fog); + queue_test(test_table_fog_zw); + queue_test(test_signed_formats); + queue_test(test_color_fill); + queue_test(test_texcoordindex); + queue_test(test_range_colorkey); + queue_test(test_shademode); + queue_test(test_lockrect_invalid); + queue_test(test_yv12_overlay); + queue_test(test_overlay_rect); + queue_test(test_blt); + queue_test(test_blt_z_alpha); + queue_test(test_color_clamping); + queue_test(test_getdc); + queue_test(test_draw_primitive); + queue_test(test_edge_antialiasing_blending); + queue_test(test_surface_desc_size); + queue_test(test_get_surface_from_dc); + queue_test(test_ck_operation); + queue_test(test_vb_refcount); + queue_test(test_compute_sphere_visibility); + queue_test(test_clip_planes_limits); + queue_test(test_texture_stages_limits); + queue_test(test_set_render_state); + queue_test(test_depth_readback); + queue_test(test_clear); + queue_test(test_enum_surfaces); + queue_test(test_viewport); + queue_test(test_device_load); + queue_test(test_color_vertex); + queue_test(test_sysmem_draw); + queue_test(test_multiply_transform); + queue_test(test_alphatest); + queue_test(test_clipper_refcount); + queue_test(test_begin_end_state_block); + queue_test(test_d32_support); + + run_queued_tests(); + + /* These tests don't work reliably when run in parallel. */ + test_colorkey_precision(); + test_offscreen_overlay(); + test_map_synchronisation(); + test_caps(); + /* These tests use full-screen/exclusive mode, so shouldn't run in + * parallel. */ test_coop_level_create_device_window(); - test_clipper_blt(); test_coop_level_d3d_state(); - test_surface_interface_mismatch(); test_coop_level_threaded(); - test_depth_blit(); - test_texture_load_ckey(); - test_zenable(); - test_ck_rgba(); - test_ck_default(); test_ck_complex(); - test_surface_qi(); - test_device_qi(); test_wndproc(); test_window_style(); test_redundant_mode_set(); test_coop_level_mode_set(); test_coop_level_mode_set_multi(); - test_initialize(); - test_coop_level_surf_create(); - test_vb_discard(); - test_coop_level_multi_window(); - test_draw_strided(); - test_lighting(); - test_specular_lighting(); - test_clear_rect_count(); test_coop_level_versions(); - test_fog_special(); - test_lighting_interface_versions(); test_coop_level_activateapp(); - test_texturemanage(); - test_block_formats_creation(); - test_unsupported_formats(); - test_rt_caps(); test_primary_caps(); - test_surface_lock(); - test_surface_discard(); test_flip(); - test_set_surface_desc(); - test_user_memory_getdc(); - test_sysmem_overlay(); test_primary_palette(); test_surface_attachment(); - test_private_data(); - test_pixel_format(); - test_create_surface_pitch(); - test_mipmap(); - test_palette_complex(); - test_p8_blit(); - test_material(); test_palette_gdi(); test_palette_alpha(); - test_vb_writeonly(); test_lost_device(); - test_resource_priority(); - test_surface_desc_lock(); - test_fog_interpolation(); - test_fog_process_vertices(); - test_negative_fixedfunction_fog(); - test_table_fog_zw(); - test_signed_formats(); - test_color_fill(); - test_texcoordindex(); - test_colorkey_precision(); - test_range_colorkey(); - test_shademode(); - test_lockrect_invalid(); - test_yv12_overlay(); - test_offscreen_overlay(); - test_overlay_rect(); - test_blt(); - test_blt_z_alpha(); test_cross_device_blt(); - test_color_clamping(); - test_getdc(); - test_draw_primitive(); - test_edge_antialiasing_blending(); test_display_mode_surface_pixel_format(); - test_surface_desc_size(); - test_get_surface_from_dc(); - test_ck_operation(); - test_vb_refcount(); - test_compute_sphere_visibility(); - test_clip_planes_limits(); - test_texture_stages_limits(); - test_set_render_state(); - test_map_synchronisation(); - test_depth_readback(); - test_clear(); - test_enum_surfaces(); - test_viewport(); - test_device_load(); - test_color_vertex(); test_killfocus(); - test_sysmem_draw(); test_gdi_surface(); - test_multiply_transform(); - test_alphatest(); - test_clipper_refcount(); - test_begin_end_state_block(); - test_caps(); - test_d32_support(); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=55490
Your paranoid android.
=== wxppro (32 bit report) ===
ddraw: ddraw1: Timeout
=== w2003std (task log) ===
Task errors: The task timed out
=== wvistau64_zh_CN (32 bit report) ===
ddraw: ddraw1.c:1020: Test failed: Got unexpected bounding rect (18,38)-(23,482), expected (18,38)-(642,482).
=== w8 (32 bit report) ===
ddraw: ddraw1.c:1899: Test failed: Got unexpected color 0x000000ff. ddraw1.c:1935: Test failed: Got unexpected color 0x000000ff. ddraw1: Timeout
=== w8adm (32 bit report) ===
ddraw: ddraw1: Timeout
=== w864 (32 bit report) ===
ddraw: ddraw1.c:1899: Test failed: Got unexpected color 0x000000ff. ddraw1.c:1935: Test failed: Got unexpected color 0x000000ff. ddraw1: Timeout
=== w1064v1507 (32 bit report) ===
ddraw: ddraw1.c:1899: Test failed: Got unexpected color 0x000000ff. ddraw1.c:1935: Test failed: Got unexpected color 0x000000ff. ddraw1: Timeout
=== w1064v1809 (32 bit report) ===
ddraw: ddraw1: Timeout
=== w7pro64 (64 bit report) ===
ddraw: ddraw1.c:1020: Test failed: Got unexpected bounding rect (18,40)-(25,482), expected (18,40)-(642,482).
=== w864 (64 bit report) ===
ddraw: ddraw1.c:13049: Test failed: Got unexpected caps 0x421350. ddraw1.c:13055: Test failed: Got unexpected hr 0x80004005. 07cc:ddraw1: unhandled exception c0000005 at 0000000000437C67
=== w1064v1507 (64 bit report) ===
ddraw: 071c:ddraw1: unhandled exception c0000005 at 0000000000437C67
=== w1064v1809 (64 bit report) ===
ddraw: 0b9c:ddraw1: unhandled exception c0000005 at 0000000000437C67
=== wxppro (32 bit report) ===
ddraw: 0944:ddraw2: unhandled exception c0000005 at 737653F4
=== w2003std (32 bit report) ===
ddraw: 01e8:ddraw2: unhandled exception c0000005 at 73888F82
Report errors: ddraw:ddraw2 has unaccounted for skip messages
=== wvistau64_zh_CN (32 bit report) ===
ddraw: ddraw2.c:2975: Test failed: Expected message 0x46, but didn't receive it. ddraw2.c:2977: Test failed: Expected screen size 1024x768, got 0x0. ddraw2.c:2983: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3013: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3020: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3046: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3069: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3098: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3124: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3144: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3180: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3190: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3216: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3239: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3261: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3287: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3307: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745). ddraw2.c:3344: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,745).
=== wvistau64_fr (32 bit report) ===
ddraw: ddraw2: Timeout
=== wvistau64_fr (task log) ===
Task errors: An error occurred while waiting for the test to complete: network read timed out (wait2/connect:AgentVersion.h:0/9) The test VM has crashed, rebooted or lost connectivity (or the TestAgent server died) The previous 2 run(s) terminated abnormally
=== wvistau64_he (32 bit report) ===
ddraw: ddraw2: Timeout
=== wvistau64_he (task log) ===
Task errors: An error occurred while waiting for the test to complete: network read timed out (wait2/connect:AgentVersion.h:0/9) The test VM has crashed, rebooted or lost connectivity (or the TestAgent server died) The previous 2 run(s) terminated abnormally
=== w8 (32 bit report) ===
ddraw: ddraw2.c:1893: Test failed: Expected color 0x00ff0000 for test 0, got 0x0000ff00. ddraw2.c:1911: Test failed: Expected color 0x000000ff for test 0, got 0x0000ff00. ddraw2.c:1893: Test failed: Expected color 0x00ff0000 for test 1, got 0x0000ff00. ddraw2.c:1911: Test failed: Expected color 0x000000ff for test 1, got 0x0000ff00. ddraw2: Timeout
=== w8adm (32 bit report) ===
ddraw: ddraw2.c:1893: Test failed: Expected color 0x00ff0000 for test 1, got 0x0000ff00. ddraw2.c:1911: Test failed: Expected color 0x000000ff for test 1, got 0x0000ff00. ddraw2: Timeout
=== w864 (32 bit report) ===
ddraw: ddraw2: Timeout
=== w1064v1507 (32 bit report) ===
ddraw: ddraw2: Timeout
=== w1064v1809 (32 bit report) ===
ddraw: ddraw2: Timeout
=== w864 (64 bit report) ===
ddraw: ddraw2.c:13928: Test failed: Got unexpected caps 0x421350. ddraw2.c:13934: Test failed: Got unexpected hr 0x80004005. 074c:ddraw2: unhandled exception c0000005 at 000000000046BE4B
=== w1064v1507 (64 bit report) ===
ddraw: 0658:ddraw2: unhandled exception c0000005 at 000000000046BE4B
=== w1064v1809 (64 bit report) ===
ddraw: 0b98:ddraw2: unhandled exception c0000005 at 000000000046BE4B
=== w2003std (32 bit report) ===
ddraw: ddraw4.c:1026: Test failed: Failed to get client rect. ddraw4.c:1028: Test failed: Failed to map client rect. ddraw4.c:1040: Test failed: Failed to get clip list size, hr 0x887600cd. ddraw4.c:1043: Test failed: Failed to get clip list, hr 0x887600cd. ddraw4.c:1044: Test failed: Got unexpected structure size 0x2d0ea0. ddraw4.c:1045: Test failed: Got unexpected type 0x2f0000. ddraw4.c:1046: Test failed: Got unexpected count 0. ddraw4.c:1047: Test failed: Got unexpected bounding rect (2359944,2985992)-(2469666,0), expected (0,0)-(0,0). ddraw4.c:1066: Test failed: Got unexpected hr 0. ddraw4.c:1152: Test failed: Got unexpected hr 0.
=== wvistau64_zh_CN (32 bit report) ===
ddraw: ddraw4.c:1047: Test failed: Got unexpected bounding rect (18,38)-(23,482), expected (18,38)-(642,482).
=== wvistau64_fr (task log) ===
Task errors: The previous 1 run(s) terminated abnormally
=== wvistau64_he (32 bit report) ===
ddraw: ddraw4: Timeout
=== wvistau64_he (task log) ===
Task errors: An error occurred while waiting for the test to complete: network read timed out (wait2/connect:AgentVersion.h:0/9) The test VM has crashed, rebooted or lost connectivity (or the TestAgent server died) The previous 2 run(s) terminated abnormally
=== w8 (32 bit report) ===
ddraw: ddraw4: Timeout
=== w8adm (32 bit report) ===
ddraw: ddraw4.c:2184: Test failed: Got unexpected color 0x000000ff. ddraw4: Timeout
=== w864 (32 bit report) ===
ddraw: ddraw4: Timeout
=== w1064v1507 (32 bit report) ===
ddraw: ddraw4: Timeout
=== w1064v1809 (32 bit report) ===
ddraw: ddraw4: Timeout
=== wvistau64_zh_CN (32 bit report) ===
ddraw: ddraw7.c:2756: Test failed: Expected message 0x46, but didn't receive it. ddraw7.c:2759: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw7.c:2763: Test failed: Got unexpect screen size 1024x768.
=== wvistau64_fr (task log) ===
Task errors: The previous 1 run(s) terminated abnormally
=== wvistau64_he (32 bit report) ===
ddraw: ddraw7: Timeout
=== wvistau64_he (task log) ===
Task errors: An error occurred while waiting for the test to complete: network read timed out (wait2/connect:AgentVersion.h:0/9) The test VM has crashed, rebooted or lost connectivity (or the TestAgent server died) The previous 2 run(s) terminated abnormally
=== w7pro64 (32 bit report) ===
ddraw: ddraw7.c:933: Test failed: Got unexpected bounding rect (18,40)-(25,482), expected (18,40)-(642,482).
=== w8 (32 bit report) ===
ddraw: ddraw7.c:4935: Test failed: Failed to end scene, hr 0x887601c2. ddraw7.c:332: Test failed: Failed to lock surface, hr 0x887601c2. ddraw7.c:4943: Test failed: Got unexpected color 0xdeadbeef, expected 0x000000ff, test 34. ddraw7.c:4930: Test failed: Failed to begin scene, hr 0x887601c2. ddraw7.c:4935: Test failed: Failed to end scene, hr 0x887602f9. ddraw7.c:332: Test failed: Failed to lock surface, hr 0x887601c2. ddraw7.c:4943: Test failed: Got unexpected color 0xdeadbeef, expected 0x000000ff, test 35. ddraw7.c:4930: Test failed: Failed to begin scene, hr 0x887601c2. ddraw7.c:4935: Test failed: Failed to end scene, hr 0x887602f9. ddraw7.c:332: Test failed: Failed to lock surface, hr 0x887601c2. ddraw7.c:4943: Test failed: Got unexpected color 0xdeadbeef, expected 0x008080ff, test 36. ddraw7.c:4930: Test failed: Failed to begin scene, hr 0x887601c2. ddraw7.c:4935: Test failed: Failed to end scene, hr 0x887602f9. ddraw7.c:332: Test failed: Failed to lock surface, hr 0x887601c2. ddraw7.c:4943: Test failed: Got unexpected color 0xdeadbeef, expected 0x008080ff, test 37. ddraw7.c:4930: Test failed: Failed to begin scene, hr 0x887601c2. ddraw7.c:4935: Test failed: Failed to end scene, hr 0x887602f9. ddraw7.c:332: Test failed: Failed to lock surface, hr 0x887601c2. ddraw7.c:4943: Test failed: Got unexpected color 0xdeadbeef, expected 0x008080ff, test 38. ddraw7.c:4930: Test failed: Failed to begin scene, hr 0x887601c2. ddraw7.c:4935: Test failed: Failed to end scene, hr 0x887602f9. ddraw7.c:332: Test failed: Failed to lock surface, hr 0x887601c2. ddraw7.c:4943: Test failed: Got unexpected color 0xdeadbeef, expected 0x008080ff, test 39. ddraw7: Timeout
=== w8 (task log) ===
Task errors: The task timed out
=== w864 (32 bit report) ===
ddraw: ddraw7.c:1681: Test failed: Expected color 0x00ff0000 for test 1, got 0x0000ff00. ddraw7.c:1699: Test failed: Expected color 0x000000ff for test 1, got 0x0000ff00.
=== w1064v1507 (32 bit report) ===
ddraw: ddraw7.c:493: Test failed: Failed to attach depth buffer, hr 0x887601c2. ddraw7: Timeout
=== w1064v1809 (32 bit report) ===
ddraw: ddraw7: Timeout
=== debian10 (32 bit report) ===
ddraw: ddraw1: Timeout ddraw2: Timeout ddraw4: Timeout ddraw7: Timeout
=== debian10 (32 bit French report) ===
ddraw: ddraw1: Timeout ddraw2: Timeout ddraw4.c:11540: Test failed: Test 0 shading has color1 000000ff, expected 0000ff00. ddraw4: Timeout ddraw7.c:11544: Test failed: Test 0 shading has color1 000000ff, expected 0000ff00. ddraw7: Timeout
=== debian10 (build log) ===
Task errors: The task timed out
=== debian10 (32 bit WoW report) ===
ddraw: ddraw1: Timeout ddraw2: Timeout ddraw4: Timeout ddraw7: Timeout
=== debian10 (build log) ===
Task errors: The task timed out
Henri Verbeet hverbeet@codeweavers.com writes:
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
v2: Get rid of a leftover debug line.
This supersedes patch 168626.
dlls/ddraw/tests/ddraw1.c | 187 +++++++++++++++++++++++++---------- dlls/ddraw/tests/ddraw2.c | 204 ++++++++++++++++++++++++++------------ dlls/ddraw/tests/ddraw4.c | 229 +++++++++++++++++++++++++++++-------------- dlls/ddraw/tests/ddraw7.c | 243 ++++++++++++++++++++++++++++++---------------- 4 files changed, 593 insertions(+), 270 deletions(-)
ddraw doesn't seem quite ready for this:
../../../tools/runtest -q -P wine -T ../../.. -M ddraw.dll -p ddraw_test.exe ddraw1 && touch ddraw1.ok 0047:err:ntdll:RtlpWaitForCriticalSection section 0x7e6cf620 "wined3d_main.c: wined3d_cs" wait timed out in thread 0047, blocked by 0046, retrying (60 sec) 003f:err:ntdll:RtlpWaitForCriticalSection section 0x7e053020 "window.c: win_data_section" wait timed out in thread 003f, blocked by 003e, retrying (60 sec) 0026:err:clipboard:convert_selection Timed out waiting for SelectionNotify event
(and similar issues with the other tests)
On Thu, 15 Aug 2019 at 23:59, Alexandre Julliard julliard@winehq.org wrote:
ddraw doesn't seem quite ready for this:
../../../tools/runtest -q -P wine -T ../../.. -M ddraw.dll -p ddraw_test.exe ddraw1 && touch ddraw1.ok 0047:err:ntdll:RtlpWaitForCriticalSection section 0x7e6cf620 "wined3d_main.c: wined3d_cs" wait timed out in thread 0047, blocked by 0046, retrying (60 sec) 003f:err:ntdll:RtlpWaitForCriticalSection section 0x7e053020 "window.c: win_data_section" wait timed out in thread 003f, blocked by 003e, retrying (60 sec) 0026:err:clipboard:convert_selection Timed out waiting for SelectionNotify event
(and similar issues with the other tests)
It appears to work reliably here, but I guess that just means I haven't been trying hard enough.