Francois Gouget : shell32/tests: Fix the temporary directory creation in shlexec.

Alexandre Julliard julliard at winehq.org
Fri Mar 27 16:14:38 CDT 2020


Module: wine
Branch: master
Commit: fd7e5741aeb35f8c55869a9a8379712e85672c46
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=fd7e5741aeb35f8c55869a9a8379712e85672c46

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Mar 26 21:53:06 2020 +0100

shell32/tests: Fix the temporary directory creation in shlexec.

Since the test no longer uses a random directory name, the directory is
more likely to exist already. So use it even if it already exists.
Also on some Windows versions (e.g. Windos 2008) GetLongPathName() does
not return the long name if the path does not exist. So do the
conversion before appending the new directory name.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shell32/tests/shlexec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index b49297bb41..8ee662321d 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -2693,16 +2693,17 @@ static void init_test(void)
         strcpy(tmpdir, "c:\\");
     else
         GetTempPathA(sizeof(tmpdir), tmpdir);
+    GetLongPathNameA(tmpdir, tmpdir, sizeof(tmpdir));
 
     /* In case of a failure it is necessary to show the path that was passed to
      * ShellExecute(). That means the paths must not be randomized so as not to
      * prevent the TestBot from detecting new failures.
      */
     strcat(tmpdir, "wtShlexecDir");
-    GetLongPathNameA(tmpdir, tmpdir, sizeof(tmpdir));
     DeleteFileA( tmpdir );
     rc = CreateDirectoryA( tmpdir, NULL );
-    ok( rc, "failed to create %s err %u\n", tmpdir, GetLastError() );
+    ok( rc || GetLastError() == ERROR_ALREADY_EXISTS,
+        "failed to create %s err %u\n", tmpdir, GetLastError() );
     /* Set %TMPDIR% for the tests */
     SetEnvironmentVariableA("TMPDIR", tmpdir);
 




More information about the wine-cvs mailing list