[1/4] kernel32/tests: Accept the case when WriteFile is able to complete the request immediately for an overlapped COM-port write.

Dmitry Timoshkov dmitry at baikal.ru
Thu Oct 24 22:14:24 CDT 2013


The behaviour depends on the driver and hardware used.
---
 dlls/kernel32/tests/comm.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/dlls/kernel32/tests/comm.c b/dlls/kernel32/tests/comm.c
index cf1c0c2..844c86d 100644
--- a/dlls/kernel32/tests/comm.c
+++ b/dlls/kernel32/tests/comm.c
@@ -840,10 +840,9 @@ static void test_waittxempty(void)
     SetLastError(0xdeadbeef);
     res = WriteFile(hcom, tbuf, sizeof(tbuf), &bytes, &ovl_write);
     after = GetTickCount();
-todo_wine
-    ok(!res && GetLastError() == ERROR_IO_PENDING, "WriteFile returned %d, error %d\n", res, GetLastError());
-todo_wine
-    ok(!bytes, "expected 0, got %u\n", bytes);
+    ok((!res && GetLastError() == ERROR_IO_PENDING) || (res && bytes == sizeof(tbuf)),
+       "WriteFile returned %d, written %u bytes, error %d\n", res, bytes, GetLastError());
+    if (!res) ok(!bytes, "expected 0, got %u\n", bytes);
     ok(after - before < 30, "WriteFile took %d ms to write %d Bytes at %d Baud\n",
        after - before, bytes, baud);
     /* don't wait for WriteFile completion */
@@ -915,10 +914,9 @@ todo_wine
             before = GetTickCount();
             SetLastError(0xdeadbeef);
             res = WriteFile(hcom, tbuf, sizeof(tbuf), &bytes, &ovl_write);
-todo_wine
-            ok(!res && GetLastError() == ERROR_IO_PENDING, "WriteFile returned %d, error %d\n", res, GetLastError());
-todo_wine
-            ok(!bytes, "expected 0, got %u\n", bytes);
+            ok((!res && GetLastError() == ERROR_IO_PENDING) || (res && bytes == sizeof(tbuf)),
+               "WriteFile returned %d, written %u bytes, error %d\n", res, bytes, GetLastError());
+            if (!res) ok(!bytes, "expected 0, got %u\n", bytes);
 
             ClearCommError(hcom, &errors, &stat);
             ok(stat.cbInQue == 0, "InQueue should be empty, got %d bytes\n", stat.cbInQue);
@@ -2089,8 +2087,7 @@ static void test_read_write(void)
     iob.Information = -1;
     offset.QuadPart = 0;
     status = pNtWriteFile(hcom, 0, NULL, NULL, &iob, atz, sizeof(atz), &offset, NULL);
-todo_wine
-    ok(status == STATUS_PENDING, "expected STATUS_PENDING, got %#x\n", status);
+    ok(status == STATUS_PENDING || status == STATUS_SUCCESS, "expected STATUS_PENDING or STATUS_SUCCESS, got %#x\n", status);
     /* Under Windows checking IO_STATUS_BLOCK right after the call leads
      * to races, iob.Status is either -1 or STATUS_SUCCESS, which means
      * that it's set only when the operation completes.
-- 
1.8.4.1




More information about the wine-patches mailing list