Paul Vriens : kernel32/tests: Fix some test failures on Win9x and WinME.

Alexandre Julliard julliard at winehq.org
Mon Mar 30 12:08:41 CDT 2009


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

Author: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date:   Mon Mar 30 10:43:50 2009 +0200

kernel32/tests: Fix some test failures on Win9x and WinME.

---

 dlls/kernel32/tests/profile.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c
index ab7c7fa..5120ec7 100644
--- a/dlls/kernel32/tests/profile.c
+++ b/dlls/kernel32/tests/profile.c
@@ -802,6 +802,8 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
     DeleteFileA(filename);
 }
 
+static DWORD timeout = 0;
+
 static BOOL check_file_data(LPCSTR path, LPCSTR data)
 {
     HANDLE file;
@@ -809,6 +811,10 @@ static BOOL check_file_data(LPCSTR path, LPCSTR data)
     DWORD size;
     BOOL ret;
 
+    /* Sleep() is needed on Win9x and WinME */
+    if (timeout)
+        Sleep(timeout);
+
     file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
     if (file == INVALID_HANDLE_VALUE)
       return FALSE;
@@ -847,6 +853,8 @@ static void test_WritePrivateProfileString(void)
        broken(GetLastError() == ERROR_INVALID_PARAMETER) || /* NT4 */
        broken(GetLastError() == 0xdeadbeef), /* Win9x and WinME */
        "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+    if (GetLastError() == 0xdeadbeef)
+        timeout = 1000;
     ok(GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES,
        "Expected path to not exist\n");
 
@@ -905,7 +913,9 @@ static void test_WritePrivateProfileString(void)
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
     todo_wine
     {
-        ok(check_file_data(path, data), "File doesn't match\n");
+        ok(check_file_data(path, data) ||
+           (broken(GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES)), /* Win9x and WinME */
+           "File doesn't match\n");
     }
     DeleteFileA(path);
 
@@ -913,15 +923,20 @@ static void test_WritePrivateProfileString(void)
     data = "[App]\r\n"
            "key=\r\n";
     ret = WritePrivateProfileStringA("App", "key", "", path);
-    ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(check_file_data(path, data), "File doesn't match\n");
+    ok(ret == TRUE ||
+       broken(!ret), /* Win9x and WinME */
+       "Expected TRUE, got %d\n", ret);
+    ok(check_file_data(path, data) ||
+       (broken(GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES)), /* Win9x and WinME */
+       "File doesn't match\n");
     DeleteFileA(path);
 
     /* empty lpFileName */
     SetLastError(0xdeadbeef);
     ret = WritePrivateProfileStringA("App", "key", "string", "");
     ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
-    ok(GetLastError() == ERROR_ACCESS_DENIED,
+    ok(GetLastError() == ERROR_ACCESS_DENIED ||
+       broken(GetLastError() == ERROR_PATH_NOT_FOUND), /* Win9x and WinME */
        "Expected ERROR_ACCESS_DENIED, got %d\n", GetLastError());
 
     /* The resulting file will be  X:\\%WINDIR%\\win1.tmp */




More information about the wine-cvs mailing list