Followup of 0eab97ffa8.
Usually version checks have to be avoided, but this modifies a pre-existing version check to skip that single test just with Windows 7.
[Test pattern page.](https://test.winehq.org/data/patterns.html#shell32:shlfileop)
[Testbot run with this patch included.](https://testbot.winehq.org/JobDetails.pl?Key=157955)
CC: @zhui
From: Bernhard Übelacker bernhardu@mailbox.org
Followup of 0eab97ffa8. --- dlls/shell32/tests/shlfileop.c | 75 +++++++++++++++------------------- 1 file changed, 32 insertions(+), 43 deletions(-)
diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c index d69995d06eb..96d21317a94 100644 --- a/dlls/shell32/tests/shlfileop.c +++ b/dlls/shell32/tests/shlfileop.c @@ -46,7 +46,7 @@ broken(retval == ret_prewin32),\ "Expected %d, got %ld\n", ret, retval)
-static BOOL old_shell32 = FALSE; +static DLLVERSIONINFO dllver;
static CHAR CURR_DIR[MAX_PATH]; static const WCHAR UNICODE_PATH[] = L"c:\\x00ae\0"; @@ -831,9 +831,17 @@ static void test_rename(void) check_file_operation(FO_RENAME, FOF_NO_UI, "test1.txt\0", "test2.txt\0", ERROR_SUCCESS, FALSE, FALSE, FALSE); - check_file_operation(FO_RENAME, FOF_NO_UI, - "testdir2\0", "testdir4\0", - ERROR_SUCCESS, FALSE, TRUE, FALSE); + /* Hangs with Windows 7 */ + if (winetest_platform_is_wine || + dllver.dwMajorVersion > 6 || + (dllver.dwMajorVersion == 6 && dllver.dwMinorVersion > 1)) + { + check_file_operation(FO_RENAME, FOF_NO_UI, + "testdir2\0", "testdir4\0", + ERROR_SUCCESS, FALSE, TRUE, FALSE); + } + else + win_skip("Skip FO_RENAME with already existing target directory.\n");
/* Empty source or target. */ clean_after_shfo_tests(); @@ -2489,42 +2497,26 @@ test_shlmenu(void) { DestroyMenu (src_menu); }
-/* Check for old shell32 (4.0.x) */ -static BOOL is_old_shell32(void) +/* Documentation states function DllGetVersion appeared first in shell32.dll version 4.71. */ +static void init_dllver(void) { - SHFILEOPSTRUCTA shfo; - CHAR from[5*MAX_PATH]; - CHAR to[5*MAX_PATH]; - DWORD retval; + HMODULE hdll; + HRESULT (WINAPI *pDllGetVersion)(DLLVERSIONINFO*);
- shfo.hwnd = NULL; - shfo.wFunc = FO_COPY; - shfo.pFrom = from; - shfo.pTo = to; - /* FOF_NOCONFIRMMKDIR is needed for old shell32 */ - shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI | FOF_MULTIDESTFILES | FOF_NOCONFIRMMKDIR; - shfo.hNameMappings = NULL; - shfo.lpszProgressTitle = NULL; - - set_curr_dir_path(from, "test1.txt\0test2.txt\0test3.txt\0"); - set_curr_dir_path(to, "test6.txt\0test7.txt\0"); - retval = SHFileOperationA(&shfo); - - /* Delete extra files on old shell32 and Vista+*/ - DeleteFileA("test6.txt\test1.txt"); - /* Delete extra files on old shell32 */ - DeleteFileA("test6.txt\test2.txt"); - DeleteFileA("test6.txt\test3.txt"); - /* Delete extra directory on old shell32 and Vista+ */ - RemoveDirectoryA("test6.txt"); - /* Delete extra files/directories on Vista+*/ - DeleteFileA("test7.txt\test2.txt"); - RemoveDirectoryA("test7.txt"); - - if (retval == ERROR_SUCCESS) - return TRUE; - - return FALSE; + hdll=GetModuleHandleA("shell32.dll"); + pDllGetVersion=(void*)GetProcAddress(hdll, "DllGetVersion"); + if (pDllGetVersion) + { + dllver.cbSize=sizeof(dllver); + pDllGetVersion(&dllver); + trace("major=%ld minor=%ld build=%ld platform=%ld\n", + dllver.dwMajorVersion, dllver.dwMinorVersion, + dllver.dwBuildNumber, dllver.dwPlatformID); + } + else + { + memset(&dllver, 0, sizeof(dllver)); + } }
struct progress_sink @@ -3199,11 +3191,8 @@ static void test_file_operation(void)
START_TEST(shlfileop) { - clean_after_shfo_tests(); - - init_shfo_tests(); - old_shell32 = is_old_shell32(); - if (old_shell32) + init_dllver(); + if (dllver.dwMajorVersion < 4 || (dllver.dwMajorVersion == 4 && dllver.dwMinorVersion < 71)) win_skip("Need to cater for old shell32 (4.0.x) on Win95\n");
clean_after_shfo_tests();
CI detected failures in windows in shell32:systray. But these seem already existing before due to [pattern page](https://test.winehq.org/data/patterns.html#shell32:systray).
Ziqing Hui (@zhui) commented about dlls/shell32/tests/shlfileop.c:
DestroyMenu (src_menu); }
-/* Check for old shell32 (4.0.x) */ -static BOOL is_old_shell32(void) +/* Documentation states function DllGetVersion appeared first in shell32.dll version 4.71. */
Where can I find the document?
Also I have a question, looks like we only have win10 tests in gitlab MRs pipelines. Are we required to make our tests good on other windows versions when submitting MRs?
On Fri Apr 18 03:22:35 2025 +0000, Ziqing Hui wrote:
Where can I find the document?
That is [here](https://learn.microsoft.com/en-us/windows/win32/shell/versions) with the sentence `Starting with version 4.71 ...`
This looks good to me.
On Fri Apr 18 03:39:33 2025 +0000, Ziqing Hui wrote:
Also I have a question, looks like we only have win10 tests in gitlab MRs pipelines. Are we required to make our tests good on other windows versions when submitting MRs?
That is too much of a question for me, but there exists the testbot where some version of windows are available for testing, and is running daily against current git, with more than just the gitlab available windows versions, and one can also easily submit patches against.
In my view the gitlab CI is just the minimum that should succeed, but having tests succeed on testbot is desireable.
On Fri Apr 18 03:39:33 2025 +0000, Bernhard Übelacker wrote:
That is too much of a question for me, but there exists the testbot where some version of windows are available for testing, and is running daily against current git, with more than just the gitlab available windows versions, and one can also easily submit patches against. https://test.winehq.org/data/ https://testbot.winehq.org/ In my view the gitlab CI is just the minimum that should succeed, but having tests succeed on testbot is desireable.
If I got it right, the long term plan is to have just gitlab CI at some point, but currently testbot has more windows versions available.