Allowing the job to fail to avoid failing the pipeline. Some new tests are failing with it, and some are succeeding todo_wine.
-- v3: gitlab: Run user32 32-bit tests with nulldrv driver.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/user32/tests/monitor.c | 6 ++++ dlls/user32/tests/msg.c | 6 ++++ dlls/user32/tests/user32_test.h | 57 +++++++++++++++++++++++++++++++++ dlls/user32/tests/win.c | 7 ++++ 4 files changed, 76 insertions(+) create mode 100644 dlls/user32/tests/user32_test.h
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index 1dff85b9621..19b4efd827a 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -37,6 +37,8 @@ #include "wine/heap.h" #include <stdio.h>
+#include "user32_test.h" + DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_GPU_LUID, 0xca085853, 0x16ce, 0x48aa, 0xb1, 0x14, 0xde, 0x9c, 0x72, 0x33, 0x42, 0x23, 1); DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_OUTPUT_ID, 0xca085853, 0x16ce, 0x48aa, 0xb1, 0x14, 0xde, 0x9c, 0x72, 0x33, 0x42, 0x23, 2);
@@ -2214,6 +2216,7 @@ static void _check_display_dc(INT line, HDC hdc, const DEVMODEA *dm, BOOL allow_ dm->dmDisplayFrequency, value);
value = GetDeviceCaps(hdc, BITSPIXEL); + todo_wine_if(is_driver( L"null" ) && dm->dmBitsPerPel == 16) ok_(__FILE__, line)(value == dm->dmBitsPerPel, "Expected BITSPIXEL %ld, got %d.\n", dm->dmBitsPerPel, value);
@@ -2366,6 +2369,7 @@ static void test_display_dc(void) if (res == DISP_CHANGE_SUCCESSFUL) { value = GetDeviceCaps(hdc, BITSPIXEL); + todo_wine_if(is_driver( L"null" ) && bpps[i] == 16) ok(value == (bpps[i] == 4 ? 1 : bpps[i]), "Expected %d, got %d.\n", (bpps[i] == 4 ? 1 : bpps[i]), value);
@@ -2430,10 +2434,12 @@ static void test_display_dc(void) * into the new compatible DC */ mem_dc = CreateCompatibleDC(hdc); bpp = GetDeviceCaps(mem_dc, BITSPIXEL); + todo_wine_if(is_driver( L"null" )) ok(bpp == dm2.dmBitsPerPel, "Expected bpp %ld, got %d.\n", dm2.dmBitsPerPel, bpp); old_hbitmap = SelectObject(mem_dc, hbitmap); ok(!!old_hbitmap, "Failed to select bitmap.\n"); bpp = GetDeviceCaps(mem_dc, BITSPIXEL); + todo_wine_if(is_driver( L"null" )) ok(bpp == dm2.dmBitsPerPel, "Expected bpp %ld, got %d.\n", dm2.dmBitsPerPel, bpp); SelectObject(mem_dc, old_hbitmap); DeleteDC(mem_dc); diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 35e4f0dd1f8..3f892c0bc91 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -36,6 +36,8 @@
#include "wine/test.h"
+#include "user32_test.h" + #define MDI_FIRST_CHILD_ID 2004
/* undocumented SWP flags - from SDK 3.1 */ @@ -12763,9 +12765,11 @@ static DWORD WINAPI test_edit_ime_messages(void *unused_arg)
himc = ImmGetContext(hwnd); ret = ImmSetCompositionStringA(himc, SCS_SETSTR, "Wine", 4, NULL, 0); + todo_wine_if(is_driver( L"null" )) ok(ret, "ImmSetCompositionStringA failed.\n"); flush_sequence(); ret = ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); + todo_wine_if(is_driver( L"null" )) ok(ret, "ImmNotifyIME failed.\n"); /* Note that the following message loop is necessary to get the WM_CHAR messages because they * are posted. Same for the later message loops in this function. */ @@ -12785,9 +12789,11 @@ static DWORD WINAPI test_edit_ime_messages(void *unused_arg) ok(lr == EIMES_GETCOMPSTRATONCE, "Got unexpected lr %#Ix.\n", lr);
ret = ImmSetCompositionStringA(himc, SCS_SETSTR, "Wine", 4, NULL, 0); + todo_wine_if(is_driver( L"null" )) ok(ret, "ImmSetCompositionStringA failed.\n"); flush_sequence(); ret = ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); + todo_wine_if(is_driver( L"null" )) ok(ret, "ImmNotifyIME failed.\n"); while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); ok_sequence(edit_eimes_getcompstratonce_seq, diff --git a/dlls/user32/tests/user32_test.h b/dlls/user32/tests/user32_test.h new file mode 100644 index 00000000000..30ef19cdcc1 --- /dev/null +++ b/dlls/user32/tests/user32_test.h @@ -0,0 +1,57 @@ +/* + * Copyright 2023 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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 <stdarg.h> +#include <stddef.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" + +#include "wine/test.h" + +static inline BOOL is_driver( const WCHAR *match ) +{ + static WCHAR *cache; + + WCHAR *tmp = NULL, driver[MAX_PATH] = {0}, path[sizeof("System\CurrentControlSet\Control\Video\{}\0000") + 40]; + DWORD size = sizeof(driver); + UINT guid_atom; + HKEY key; + + if (cache) return !wcscmp( cache, match ); + + guid_atom = HandleToULong( GetPropW( GetDesktopWindow(), L"__wine_display_device_guid" ) ); + wcscpy( path, L"System\CurrentControlSet\Control\Video\{" ); + if (GlobalGetAtomNameW( guid_atom, path + wcslen( path ), 40 )) + { + wcscat( path, L"}\0000" ); + if (!RegOpenKeyW( HKEY_LOCAL_MACHINE, path, &key )) + { + if (!RegQueryValueExW( key, L"GraphicsDriver", NULL, NULL, (BYTE *)&driver, &size )) + tmp = wcsdup( driver ); + RegCloseKey(key); + } + } + + if (!tmp) tmp = wcsdup( L"" ); + if ((tmp = InterlockedExchangePointer( (void *)&cache, tmp ))) free( tmp ); + + return !wcscmp( cache, match ); +} diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 1252e046ad3..04ff254ee25 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -34,6 +34,8 @@
#include "wine/test.h"
+#include "user32_test.h" + #ifndef WM_SYSTIMER #define WM_SYSTIMER 0x0118 #endif @@ -8777,6 +8779,7 @@ static void test_GetWindowModuleFileName(void) "expected ERROR_INVALID_WINDOW_HANDLE, got %lu\n", GetLastError());
hwnd = FindWindowA("Shell_TrayWnd", NULL); + todo_wine_if(is_driver( L"null" )) ok(IsWindow(hwnd) || broken(!hwnd), "got invalid tray window %p\n", hwnd); SetLastError(0xdeadbeef); ret1 = pGetWindowModuleFileNameA(hwnd, buf1, sizeof(buf1)); @@ -9871,8 +9874,10 @@ static void test_FindWindowEx(void)
/* test behaviour with a window title that is an empty character */ found = FindWindowExA( 0, 0, "Shell_TrayWnd", "" ); + todo_wine_if(is_driver( L"null" )) ok( found != NULL, "found is NULL, expected a valid hwnd\n" ); found = FindWindowExA( 0, 0, "Shell_TrayWnd", NULL ); + todo_wine_if(is_driver( L"null" )) ok( found != NULL, "found is NULL, expected a valid hwnd\n" ); }
@@ -9927,8 +9932,10 @@ static void test_FindWindow(void)
/* test behaviour with a window title that is an empty character */ found = FindWindowA( "Shell_TrayWnd", "" ); + todo_wine_if(is_driver( L"null" )) ok( found != NULL, "found is NULL, expected a valid hwnd\n" ); found = FindWindowA( "Shell_TrayWnd", NULL ); + todo_wine_if(is_driver( L"null" )) ok( found != NULL, "found is NULL, expected a valid hwnd\n" ); }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/user32/tests/monitor.c | 2 +- dlls/user32/tests/msg.c | 3 ++- dlls/user32/tests/sysparams.c | 4 +++- dlls/user32/tests/win.c | 9 ++++++--- 4 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index 19b4efd827a..8afdda5c45f 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -2461,7 +2461,7 @@ static void test_display_dc(void) * It's most likely due to the fact that lower color depth are emulated on newer * versions of Windows as the real color depth is still 32-bit */ if (bpps[i] != 1 && bpps[i] != 32) - todo_wine_if(bpps[i] == dm2.dmBitsPerPel) + todo_wine_if(bpps[i] == dm2.dmBitsPerPel && is_driver( L"winex11.drv" )) ok(!old_hbitmap || broken(!!old_hbitmap) /* Win7 dual-QXL test bot and XP */, "Selecting bitmap succeeded.\n"); else diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 3f892c0bc91..150618bd40a 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -16934,7 +16934,8 @@ static DWORD CALLBACK post_rbuttonup_msg( void *arg ) DWORD ret;
ret = WaitForSingleObject( data->wndproc_finished, 500 ); - todo_wine ok( ret == WAIT_OBJECT_0, "WaitForSingleObject returned %lx\n", ret ); + todo_wine_if(is_driver( L"winex11.drv" )) + ok( ret == WAIT_OBJECT_0, "WaitForSingleObject returned %lx\n", ret ); if( ret == WAIT_OBJECT_0 ) return 0;
PostMessageA( data->hwnd, WM_RBUTTONUP, 0, 0 ); diff --git a/dlls/user32/tests/sysparams.c b/dlls/user32/tests/sysparams.c index 6ed7755b91b..666fa931fd1 100644 --- a/dlls/user32/tests/sysparams.c +++ b/dlls/user32/tests/sysparams.c @@ -30,6 +30,8 @@ #include "winuser.h" #include "winnls.h"
+#include "user32_test.h" + static BOOL (WINAPI *pIsProcessDPIAware)(void); static BOOL (WINAPI *pSetProcessDPIAware)(void); static BOOL (WINAPI *pSetProcessDpiAwarenessContext)(DPI_AWARENESS_CONTEXT); @@ -3574,7 +3576,7 @@ static void test_dpi_mapping(void) hdc = GetWindowDC( hwnd ); GetClipBox( hdc, &rect ); SetRect( &expect, 0, 0, 295, 303 ); - todo_wine + todo_wine_if(is_driver( L"winex11.drv" )) ok( EqualRect( &expect, &rect ), "%Iu/%Iu: wrong clip box win DC %s expected %s\n", i, j, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) ); ReleaseDC( hwnd, hdc ); diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 04ff254ee25..2b82b02fc27 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -3284,7 +3284,8 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2) ret = SetWindowPos(hwnd_child, NULL, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_SHOWWINDOW); ok(ret, "Got %d\n", ret); flush_events( TRUE ); - todo_wine check_active_state(hwnd2, hwnd2, hwnd2); + todo_wine_if(is_driver( L"winex11.drv" )) + check_active_state(hwnd2, hwnd2, hwnd2); DestroyWindow(hwnd_child); }
@@ -4036,8 +4037,10 @@ static void test_SetForegroundWindow(HWND hwnd) /* FIXME: these tests are failing because of a race condition * between internal focus state applied immediately and X11 focus * message coming late */ - todo_wine ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow()); - todo_wine ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus()); + todo_wine_if(is_driver( L"winex11.drv" )) + ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow()); + todo_wine_if(is_driver( L"winex11.drv" )) + ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus());
SetForegroundWindow(hwnd); check_wnd_state(hwnd, hwnd, hwnd, 0);
From: Rémi Bernon rbernon@codeweavers.com
--- tools/gitlab/test.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/tools/gitlab/test.yml b/tools/gitlab/test.yml index da34390bc1f..80e2dca48ae 100644 --- a/tools/gitlab/test.yml +++ b/tools/gitlab/test.yml @@ -54,6 +54,22 @@ test-linux-32: - export WINETEST_COLOR=1 - wine usr/local/lib/wine/i386-windows/winetest.exe -q -q -o - -t gitlab -u $CI_JOB_URL -n $EXCLUDE_TESTS
+test-nulldrv-32: + extends: .wine-test + variables: + INCLUDE_TESTS: user32 + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + needs: + - job: build-linux + script: + - wine reg add HKCU\Software\Wine\Drivers /v Graphics /d mac,x11,null /f + - wineserver -w + - export DISPLAY= + - export WINETEST_COLOR=1 + - wine usr/local/lib/wine/i386-windows/winetest.exe -q -q -o - -t gitlab -u $CI_JOB_URL $INCLUDE_TESTS + - wine reg delete HKCU\Software\Wine\Drivers /v Graphics /f + debian-32: extends: .wine-test rules:
So, is this not something we want to do? Any reason not to check for the current driver in tests, even if we keep the numbers low?