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
-- v2: shell32/tests: Avoid hang in test_rename.
From: Bernhard Übelacker bernhardu@mailbox.org
Followup of 0eab97ffa8. --- dlls/shell32/tests/shlfileop.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c index d69995d06eb..e367c74a4c5 100644 --- a/dlls/shell32/tests/shlfileop.c +++ b/dlls/shell32/tests/shlfileop.c @@ -730,6 +730,20 @@ static void test_delete(void) ok(!dir_exists("testdir2\nested"), "Expected testdir2\nested to not exist\n"); }
+static BOOL is_below_windows81(void) +{ + HANDLE token; + DWORD is_app_container, size = 0; + + if (!OpenProcessToken(GetCurrentProcess(), MAXIMUM_ALLOWED, &token)) + return FALSE; + + if (!GetTokenInformation(token, TokenIsAppContainer, &is_app_container, sizeof(is_app_container), &size)) + return GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_INVALID_FUNCTION; + CloseHandle(token); + return FALSE; +} + /* tests the FO_RENAME action */ static void test_rename(void) { @@ -831,9 +845,14 @@ 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); + if (!is_below_windows81()) /* Hangs with Windows 7 */ + { + 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();