Re: shell32/tests: Skip SHFileOperationW tests if the user doesn't have admin rights.
On 19.12.2016 13:38, Hans Leidekker wrote:
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> --- dlls/shell32/tests/shlfileop.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c index 0e502fc..776da98 100644 --- a/dlls/shell32/tests/shlfileop.c +++ b/dlls/shell32/tests/shlfileop.c @@ -819,7 +819,7 @@ static void test_rename(void) retval == DE_DIFFDIR || /* Vista */ broken(retval == DE_OPCANCELLED) || /* Win9x */ broken(retval == 65652), /* NT4 */ - "Expected ERROR_CANCELLED or DE_DIFFDIR\n"); + "Expected ERROR_CANCELLED or DE_DIFFDIR, got %u\n", retval); ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
/* pFrom is empty */ @@ -2516,6 +2516,11 @@ static void test_unicode(void) skip("Unicode tests skipped on non-unicode system\n"); return; } + if (GetLastError()==ERROR_ACCESS_DENIED) + { + skip("test needs admin rights\n"); + return; + } CloseHandle(file);
/* Try to delete a file with unicode filename */ @@ -2574,6 +2579,7 @@ static void test_unicode(void) ok(GetLastError() == ERROR_SUCCESS || broken(GetLastError() == ERROR_INVALID_HANDLE), /* WinXp, win2k3 */ "Expected ERROR_SUCCESS, got %d\n", GetLastError()); + DeleteFileW(UNICODE_PATH_TO);
/* Check last error after a failed file operation. */ DeleteFileW(UNICODE_PATH); Will it work if user temp directory was used instead of current directory or C: root?
On Mon, 2016-12-19 at 14:38 +0300, Nikolay Sivov wrote:
diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c index 0e502fc..776da98 100644 --- a/dlls/shell32/tests/shlfileop.c +++ b/dlls/shell32/tests/shlfileop.c @@ -819,7 +819,7 @@ static void test_rename(void) retval == DE_DIFFDIR || /* Vista */ broken(retval == DE_OPCANCELLED) || /* Win9x */ broken(retval == 65652), /* NT4 */ - "Expected ERROR_CANCELLED or DE_DIFFDIR\n"); + "Expected ERROR_CANCELLED or DE_DIFFDIR, got %u\n", retval); ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
/* pFrom is empty */ @@ -2516,6 +2516,11 @@ static void test_unicode(void) skip("Unicode tests skipped on non-unicode system\n"); return; } + if (GetLastError()==ERROR_ACCESS_DENIED) + { + skip("test needs admin rights\n"); + return; + } CloseHandle(file);
/* Try to delete a file with unicode filename */ @@ -2574,6 +2579,7 @@ static void test_unicode(void) ok(GetLastError() == ERROR_SUCCESS || broken(GetLastError() == ERROR_INVALID_HANDLE), /* WinXp, win2k3 */ "Expected ERROR_SUCCESS, got %d\n", GetLastError()); + DeleteFileW(UNICODE_PATH_TO);
/* Check last error after a failed file operation. */ DeleteFileW(UNICODE_PATH); Will it work if user temp directory was used instead of current directory or C: root?
Yes, running it from a temporary directory instead of c: makes the failure go away.
participants (2)
-
Hans Leidekker -
Nikolay Sivov