Commit b46bd115 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

kernel32/tests: Accept the case when WriteFile is able to complete the request…

kernel32/tests: Accept the case when WriteFile is able to complete the request immediately for an overlapped COM-port write. The behaviour depends on the driver and hardware used.
parent 4b94239a
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment