[1/2] ws2_32/tests: Test some completion port behaviour.

Hans Leidekker hans at codeweavers.com
Thu Dec 22 02:19:47 CST 2011


Hi Ričardas,

> +    key = 0xdeadbeef;
> +    num_bytes = 0xdeadbeef;
> +    olp = (WSAOVERLAPPED *)0xdeadbeef;
> +    bret = GetQueuedCompletionStatus( io_port, &num_bytes, &key, &olp, 100 );
> +    todo_wine ok( bret == FALSE && GetLastError() == ERROR_NETNAME_DELETED, "failed to get completion status %u\n", GetLastError() );

For tests like this you should set last error to some known value before
calling the function. And it would be better to split them up; one test
for the return value and one for the error.

> +    key = 0xdeadbeef;
> +    num_bytes = 0xdeadbeef;
> +    olp = (WSAOVERLAPPED *)0xdeadbeef;
> +    bret = GetQueuedCompletionStatus( io_port, &num_bytes, &key, &olp, 100 );
> +    todo_wine ok(bret == FALSE && GetLastError() == ERROR_OPERATION_ABORTED, "failed to get completion status %u\n", GetLastError() );
> +    todo_wine ok(key == 125, "Key is %lu\n", key);
> +    todo_wine ok(num_bytes == 0, "Number of bytes transfered is %u\n", num_bytes);
> +    todo_wine ok(olp == &ov, "Overlaped structure is at %p\n", olp);
> +    todo_wine ok(olp && (olp->Internal == (ULONG)STATUS_CANCELLED), "Internal status is %lx\n", olp ? olp->Internal : 0);

You may want to call GetQueuedCompletionStatus again here to show that
this was the last completion.





More information about the wine-devel mailing list