Dmitry Timoshkov : ntdll/tests: Always wait until the operation completes if returned status is STATUS_PENDING.
Alexandre Julliard
julliard at winehq.org
Fri Mar 21 14:33:51 CDT 2014
Module: wine
Branch: master
Commit: d5fd04f2f0e4224a0e23b78d9ae1773dab70a385
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d5fd04f2f0e4224a0e23b78d9ae1773dab70a385
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Fri Mar 21 22:12:10 2014 +0900
ntdll/tests: Always wait until the operation completes if returned status is STATUS_PENDING.
---
dlls/ntdll/tests/file.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 695f034..6406930 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -2363,12 +2363,14 @@ static void test_read_write(void)
offset.QuadPart = 0;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents, sizeof(contents), &offset, NULL);
ok(status == STATUS_PENDING || status == STATUS_SUCCESS /* before Vista */, "expected STATUS_PENDING or STATUS_SUCCESS, got %#x\n", status);
+ if (status == STATUS_PENDING)
+ {
+ ret = WaitForSingleObject(hfile, 3000);
+ ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret);
+ }
ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
ok(iob.Information == sizeof(contents), "expected sizeof(contents), got %lu\n", iob.Information);
- ret = WaitForSingleObject(hfile, 3000);
- ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret);
-
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
ok(off == 0, "expected 0, got %u\n", off);
@@ -2501,6 +2503,8 @@ todo_wine
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL);
if (status == STATUS_PENDING)
{
+ ret = WaitForSingleObject(hfile, 3000);
+ ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret);
ok(U(iob).Status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", U(iob).Status);
ok(iob.Information == 0, "expected 0, got %lu\n", iob.Information);
}
@@ -2520,6 +2524,8 @@ todo_wine
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, 0, &offset, NULL);
if (status == STATUS_PENDING)
{
+ ret = WaitForSingleObject(hfile, 3000);
+ ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret);
ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
ok(iob.Information == 0, "expected 0, got %lu\n", iob.Information);
}
@@ -2574,31 +2580,33 @@ todo_wine
offset.QuadPart = (LONGLONG)-1 /* FILE_WRITE_TO_END_OF_FILE */;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, "DCBA", 4, &offset, NULL);
ok(status == STATUS_PENDING || status == STATUS_SUCCESS /* before Vista */, "expected STATUS_PENDING or STATUS_SUCCESS, got %#x\n", status);
+ if (status == STATUS_PENDING)
+ {
+ ret = WaitForSingleObject(hfile, 3000);
+ ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret);
+ }
ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
ok(iob.Information == 4, "expected 4, got %lu\n", iob.Information);
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
ok(off == 0, "expected 0, got %u\n", off);
- ret = WaitForSingleObject(hfile, 3000);
- ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret);
-
- off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
- ok(off == 0, "expected 0, got %u\n", off);
-
U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = 0;
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL);
ok(status == STATUS_PENDING || status == STATUS_SUCCESS, "expected STATUS_PENDING or STATUS_SUCCESS, got %#x\n", status);
+ if (status == STATUS_PENDING)
+ {
+ ret = WaitForSingleObject(hfile, 3000);
+ ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret);
+ }
ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
ok(iob.Information == sizeof(contents), "expected sizeof(contents), got %lu\n", iob.Information);
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
ok(off == 0, "expected 0, got %u\n", off);
- ret = WaitForSingleObject(hfile, 3000);
- ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret);
ok(!memcmp(contents, buf, sizeof(contents) - 4), "file contents mismatch\n");
ok(!memcmp(buf + sizeof(contents) - 4, "DCBA", 4), "file contents mismatch\n");
More information about the wine-cvs
mailing list