Commit 4e9f4ee4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

kernel32/tests: Silence noisy debug traces.

parent 0a114489
......@@ -62,7 +62,7 @@ struct rpcThreadArgs
static DWORD CALLBACK rpcThreadMain(LPVOID arg)
{
struct rpcThreadArgs *rpcargs = (struct rpcThreadArgs *)arg;
trace("rpcThreadMain starting\n");
if (winetest_debug > 1) trace("rpcThreadMain starting\n");
SetLastError( rpcargs->lastError );
switch (rpcargs->op)
......@@ -82,7 +82,7 @@ static DWORD CALLBACK rpcThreadMain(LPVOID arg)
}
rpcargs->lastError = GetLastError();
trace("rpcThreadMain returning\n");
if (winetest_debug > 1) trace("rpcThreadMain returning\n");
return 0;
}
......@@ -627,7 +627,7 @@ static void test_CreateNamedPipe(int pipemode)
ok(CloseHandle(hnp), "CloseHandle\n");
trace("test_CreateNamedPipe returning\n");
if (winetest_debug > 1) trace("test_CreateNamedPipe returning\n");
}
static void test_CreateNamedPipe_instances_must_match(void)
......@@ -719,7 +719,7 @@ static void test_CreateNamedPipe_instances_must_match(void)
static DWORD CALLBACK alarmThreadMain(LPVOID arg)
{
DWORD_PTR timeout = (DWORD_PTR) arg;
trace("alarmThreadMain\n");
if (winetest_debug > 1) trace("alarmThreadMain\n");
if (WaitForSingleObject( alarm_event, timeout ) == WAIT_TIMEOUT)
{
ok(FALSE, "alarm\n");
......@@ -735,7 +735,7 @@ static DWORD CALLBACK serverThreadMain1(LPVOID arg)
{
int i;
trace("serverThreadMain1 start\n");
if (winetest_debug > 1) trace("serverThreadMain1 start\n");
/* Set up a simple echo server */
hnp = CreateNamedPipeA(PIPENAME "serverThreadMain1", PIPE_ACCESS_DUPLEX,
PIPE_TYPE_BYTE | PIPE_WAIT,
......@@ -753,30 +753,30 @@ static DWORD CALLBACK serverThreadMain1(LPVOID arg)
BOOL success;
/* Wait for client to connect */
trace("Server calling ConnectNamedPipe...\n");
if (winetest_debug > 1) trace("Server calling ConnectNamedPipe...\n");
ok(ConnectNamedPipe(hnp, NULL)
|| GetLastError() == ERROR_PIPE_CONNECTED, "ConnectNamedPipe\n");
trace("ConnectNamedPipe returned.\n");
if (winetest_debug > 1) trace("ConnectNamedPipe returned.\n");
/* Echo bytes once */
memset(buf, 0, sizeof(buf));
trace("Server reading...\n");
if (winetest_debug > 1) trace("Server reading...\n");
success = ReadFile(hnp, buf, sizeof(buf), &readden, NULL);
trace("Server done reading.\n");
if (winetest_debug > 1) trace("Server done reading.\n");
ok(success, "ReadFile\n");
ok(readden, "short read\n");
trace("Server writing...\n");
if (winetest_debug > 1) trace("Server writing...\n");
ok(WriteFile(hnp, buf, readden, &written, NULL), "WriteFile\n");
trace("Server done writing.\n");
if (winetest_debug > 1) trace("Server done writing.\n");
ok(written == readden, "write file len\n");
/* finish this connection, wait for next one */
ok(FlushFileBuffers(hnp), "FlushFileBuffers\n");
trace("Server done flushing.\n");
if (winetest_debug > 1) trace("Server done flushing.\n");
ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe\n");
trace("Server done disconnecting.\n");
if (winetest_debug > 1) trace("Server done disconnecting.\n");
}
return 0;
}
......@@ -808,28 +808,28 @@ static DWORD CALLBACK serverThreadMain2(LPVOID arg)
user_apc_ran = FALSE;
if (i == 0 && pQueueUserAPC) {
trace("Queueing an user APC\n"); /* verify the pipe is non alerable */
if (winetest_debug > 1) trace("Queueing an user APC\n"); /* verify the pipe is non alerable */
ret = pQueueUserAPC(&user_apc, GetCurrentThread(), 0);
ok(ret, "QueueUserAPC failed: %d\n", GetLastError());
}
/* Wait for client to connect */
trace("Server calling ConnectNamedPipe...\n");
if (winetest_debug > 1) trace("Server calling ConnectNamedPipe...\n");
ok(ConnectNamedPipe(hnp, NULL)
|| GetLastError() == ERROR_PIPE_CONNECTED, "ConnectNamedPipe\n");
trace("ConnectNamedPipe returned.\n");
if (winetest_debug > 1) trace("ConnectNamedPipe returned.\n");
/* Echo bytes once */
memset(buf, 0, sizeof(buf));
trace("Server reading...\n");
if (winetest_debug > 1) trace("Server reading...\n");
success = ReadFile(hnp, buf, sizeof(buf), &readden, NULL);
trace("Server done reading.\n");
if (winetest_debug > 1) trace("Server done reading.\n");
ok(success, "ReadFile\n");
trace("Server writing...\n");
if (winetest_debug > 1) trace("Server writing...\n");
ok(WriteFile(hnp, buf, readden, &written, NULL), "WriteFile\n");
trace("Server done writing.\n");
if (winetest_debug > 1) trace("Server done writing.\n");
ok(written == readden, "write file len\n");
/* finish this connection, wait for next one */
......@@ -865,7 +865,7 @@ static DWORD CALLBACK serverThreadMain3(LPVOID arg)
int i;
HANDLE hEvent;
trace("serverThreadMain3\n");
if (winetest_debug > 1) trace("serverThreadMain3\n");
/* Set up a simple echo server */
hnp = CreateNamedPipeA(PIPENAME "serverThreadMain3", PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE | PIPE_WAIT,
......@@ -898,17 +898,17 @@ static DWORD CALLBACK serverThreadMain3(LPVOID arg)
/* Wait for client to connect */
if (i == 0) {
trace("Server calling non-overlapped ConnectNamedPipe on overlapped pipe...\n");
if (winetest_debug > 1) trace("Server calling non-overlapped ConnectNamedPipe on overlapped pipe...\n");
success = ConnectNamedPipe(hnp, NULL);
err = GetLastError();
ok(success || (err == ERROR_PIPE_CONNECTED), "ConnectNamedPipe failed: %d\n", err);
trace("ConnectNamedPipe operation complete.\n");
if (winetest_debug > 1) trace("ConnectNamedPipe operation complete.\n");
} else {
trace("Server calling overlapped ConnectNamedPipe...\n");
if (winetest_debug > 1) trace("Server calling overlapped ConnectNamedPipe...\n");
success = ConnectNamedPipe(hnp, &oOverlap);
err = GetLastError();
ok(!success && (err == ERROR_IO_PENDING || err == ERROR_PIPE_CONNECTED), "overlapped ConnectNamedPipe\n");
trace("overlapped ConnectNamedPipe returned.\n");
if (winetest_debug > 1) trace("overlapped ConnectNamedPipe returned.\n");
if (!success && (err == ERROR_IO_PENDING)) {
if (letWFSOEwait)
{
......@@ -925,18 +925,18 @@ static DWORD CALLBACK serverThreadMain3(LPVOID arg)
}
}
ok(success || (err == ERROR_PIPE_CONNECTED), "GetOverlappedResult ConnectNamedPipe\n");
trace("overlapped ConnectNamedPipe operation complete.\n");
if (winetest_debug > 1) trace("overlapped ConnectNamedPipe operation complete.\n");
}
/* Echo bytes once */
memset(buf, 0, sizeof(buf));
trace("Server reading...\n");
if (winetest_debug > 1) trace("Server reading...\n");
success = ReadFile(hnp, buf, sizeof(buf), &readden, &oOverlap);
trace("Server ReadFile returned...\n");
if (winetest_debug > 1) trace("Server ReadFile returned...\n");
err = GetLastError();
ok(success || err == ERROR_IO_PENDING, "overlapped ReadFile\n");
trace("overlapped ReadFile returned.\n");
if (winetest_debug > 1) trace("overlapped ReadFile returned.\n");
if (!success && (err == ERROR_IO_PENDING)) {
if (letWFSOEwait)
{
......@@ -952,15 +952,15 @@ static DWORD CALLBACK serverThreadMain3(LPVOID arg)
success = GetOverlappedResult(hnp, &oOverlap, &readden, TRUE);
}
}
trace("Server done reading.\n");
if (winetest_debug > 1) trace("Server done reading.\n");
ok(success, "overlapped ReadFile\n");
trace("Server writing...\n");
if (winetest_debug > 1) trace("Server writing...\n");
success = WriteFile(hnp, buf, readden, &written, &oOverlap);
trace("Server WriteFile returned...\n");
if (winetest_debug > 1) trace("Server WriteFile returned...\n");
err = GetLastError();
ok(success || err == ERROR_IO_PENDING, "overlapped WriteFile\n");
trace("overlapped WriteFile returned.\n");
if (winetest_debug > 1) trace("overlapped WriteFile returned.\n");
if (!success && (err == ERROR_IO_PENDING)) {
if (letWFSOEwait)
{
......@@ -976,7 +976,7 @@ static DWORD CALLBACK serverThreadMain3(LPVOID arg)
success = GetOverlappedResult(hnp, &oOverlap, &written, TRUE);
}
}
trace("Server done writing.\n");
if (winetest_debug > 1) trace("Server done writing.\n");
ok(success, "overlapped WriteFile\n");
ok(written == readden, "write file len\n");
......@@ -994,7 +994,7 @@ static DWORD CALLBACK serverThreadMain4(LPVOID arg)
HANDLE hcompletion;
BOOL ret;
trace("serverThreadMain4\n");
if (winetest_debug > 1) trace("serverThreadMain4\n");
/* Set up a simple echo server */
hnp = CreateNamedPipeA(PIPENAME "serverThreadMain4", PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE | PIPE_WAIT,
......@@ -1026,13 +1026,13 @@ static DWORD CALLBACK serverThreadMain4(LPVOID arg)
memset(&oWrite, 0, sizeof(oWrite));
/* Wait for client to connect */
trace("Server calling overlapped ConnectNamedPipe...\n");
if (winetest_debug > 1) trace("Server calling overlapped ConnectNamedPipe...\n");
success = ConnectNamedPipe(hnp, &oConnect);
err = GetLastError();
ok(!success && (err == ERROR_IO_PENDING || err == ERROR_PIPE_CONNECTED),
"overlapped ConnectNamedPipe got %u err %u\n", success, err );
if (!success && err == ERROR_IO_PENDING) {
trace("ConnectNamedPipe GetQueuedCompletionStatus\n");
if (winetest_debug > 1) trace("ConnectNamedPipe GetQueuedCompletionStatus\n");
success = GetQueuedCompletionStatus(hcompletion, &dummy, &compkey, &oResult, 0);
if (!success)
{
......@@ -1047,14 +1047,14 @@ static DWORD CALLBACK serverThreadMain4(LPVOID arg)
ok(oResult == &oConnect, "got overlapped pointer %p instead of %p\n", oResult, &oConnect);
}
}
trace("overlapped ConnectNamedPipe operation complete.\n");
if (winetest_debug > 1) trace("overlapped ConnectNamedPipe operation complete.\n");
/* Echo bytes once */
memset(buf, 0, sizeof(buf));
trace("Server reading...\n");
if (winetest_debug > 1) trace("Server reading...\n");
success = ReadFile(hnp, buf, sizeof(buf), &readden, &oRead);
trace("Server ReadFile returned...\n");
if (winetest_debug > 1) trace("Server ReadFile returned...\n");
err = GetLastError();
ok(success || err == ERROR_IO_PENDING, "overlapped ReadFile, err=%i\n", err);
success = GetQueuedCompletionStatus(hcompletion, &readden, &compkey,
......@@ -1065,11 +1065,11 @@ static DWORD CALLBACK serverThreadMain4(LPVOID arg)
ok(compkey == 12345, "got completion key %i instead of 12345\n", (int)compkey);
ok(oResult == &oRead, "got overlapped pointer %p instead of %p\n", oResult, &oRead);
}
trace("Server done reading.\n");
if (winetest_debug > 1) trace("Server done reading.\n");
trace("Server writing...\n");
if (winetest_debug > 1) trace("Server writing...\n");
success = WriteFile(hnp, buf, readden, &written, &oWrite);
trace("Server WriteFile returned...\n");
if (winetest_debug > 1) trace("Server WriteFile returned...\n");
err = GetLastError();
ok(success || err == ERROR_IO_PENDING, "overlapped WriteFile failed, err=%u\n", err);
success = GetQueuedCompletionStatus(hcompletion, &written, &compkey,
......@@ -1081,14 +1081,14 @@ static DWORD CALLBACK serverThreadMain4(LPVOID arg)
ok(oResult == &oWrite, "got overlapped pointer %p instead of %p\n", oResult, &oWrite);
ok(written == readden, "write file len\n");
}
trace("Server done writing.\n");
if (winetest_debug > 1) trace("Server done writing.\n");
/* Client will finish this connection, the following ops will trigger broken pipe errors. */
/* Wait for the pipe to break. */
while (PeekNamedPipe(hnp, NULL, 0, NULL, &written, &written));
trace("Server writing on disconnected pipe...\n");
if (winetest_debug > 1) trace("Server writing on disconnected pipe...\n");
SetLastError(ERROR_SUCCESS);
success = WriteFile(hnp, buf, readden, &written, &oWrite);
err = GetLastError();
......@@ -1105,10 +1105,10 @@ static DWORD CALLBACK serverThreadMain4(LPVOID arg)
"WriteFile GetQueuedCompletionStatus returned %u, err=%i, oResult %p\n",
success, err, oResult);
trace("Server reading from disconnected pipe...\n");
if (winetest_debug > 1) trace("Server reading from disconnected pipe...\n");
SetLastError(ERROR_SUCCESS);
success = ReadFile(hnp, buf, sizeof(buf), &readden, &oRead);
trace("Server ReadFile from disconnected pipe returned...\n");
if (winetest_debug > 1) trace("Server ReadFile from disconnected pipe returned...\n");
err = GetLastError();
ok(!success && err == ERROR_BROKEN_PIPE,
"overlapped ReadFile on disconnected pipe returned %u, err=%i\n", success, err);
......@@ -1156,7 +1156,7 @@ static DWORD CALLBACK serverThreadMain5(LPVOID arg)
int i;
HANDLE hEvent;
trace("serverThreadMain5\n");
if (winetest_debug > 1) trace("serverThreadMain5\n");
/* Set up a simple echo server */
hnp = CreateNamedPipeA(PIPENAME "serverThreadMain5", PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE | PIPE_WAIT,
......@@ -1184,23 +1184,23 @@ static DWORD CALLBACK serverThreadMain5(LPVOID arg)
oOverlap.hEvent = hEvent;
/* Wait for client to connect */
trace("Server calling ConnectNamedPipe...\n");
if (winetest_debug > 1) trace("Server calling ConnectNamedPipe...\n");
success = ConnectNamedPipe(hnp, NULL);
err = GetLastError();
ok(success || (err == ERROR_PIPE_CONNECTED), "ConnectNamedPipe failed: %d\n", err);
trace("ConnectNamedPipe operation complete.\n");
if (winetest_debug > 1) trace("ConnectNamedPipe operation complete.\n");
/* Echo bytes once */
memset(buf, 0, sizeof(buf));
trace("Server reading...\n");
if (winetest_debug > 1) trace("Server reading...\n");
completion_called = 0;
ResetEvent(hEvent);
success = ReadFileEx(hnp, buf, sizeof(buf), &oOverlap, completion_routine);
trace("Server ReadFileEx returned...\n");
if (winetest_debug > 1) trace("Server ReadFileEx returned...\n");
ok(success, "ReadFileEx failed, err=%i\n", GetLastError());
ok(completion_called == 0, "completion routine called before ReadFileEx return\n");
trace("ReadFileEx returned.\n");
if (winetest_debug > 1) trace("ReadFileEx returned.\n");
if (success) {
DWORD ret;
do {
......@@ -1213,16 +1213,16 @@ static DWORD CALLBACK serverThreadMain5(LPVOID arg)
ok(completion_num_bytes != 0, "read 0 bytes\n");
ok(completion_lpoverlapped == &oOverlap, "got wrong overlapped pointer %p\n", completion_lpoverlapped);
readden = completion_num_bytes;
trace("Server done reading.\n");
if (winetest_debug > 1) trace("Server done reading.\n");
trace("Server writing...\n");
if (winetest_debug > 1) trace("Server writing...\n");
completion_called = 0;
ResetEvent(hEvent);
success = WriteFileEx(hnp, buf, readden, &oOverlap, completion_routine);
trace("Server WriteFileEx returned...\n");
if (winetest_debug > 1) trace("Server WriteFileEx returned...\n");
ok(success, "WriteFileEx failed, err=%i\n", GetLastError());
ok(completion_called == 0, "completion routine called before ReadFileEx return\n");
trace("overlapped WriteFile returned.\n");
if (winetest_debug > 1) trace("overlapped WriteFile returned.\n");
if (success) {
DWORD ret;
do {
......@@ -1230,7 +1230,7 @@ static DWORD CALLBACK serverThreadMain5(LPVOID arg)
} while (ret == WAIT_IO_COMPLETION);
ok(ret == 0, "wait WriteFileEx returned %x\n", ret);
}
trace("Server done writing.\n");
if (winetest_debug > 1) trace("Server done writing.\n");
ok(completion_called == 1, "completion routine called %i times\n", completion_called);
ok(completion_errorcode == ERROR_SUCCESS, "completion routine got error %d\n", completion_errorcode);
ok(completion_num_bytes == readden, "read %i bytes wrote %i\n", readden, completion_num_bytes);
......@@ -1247,7 +1247,7 @@ static void exercizeServer(const char *pipename, HANDLE serverThread)
{
int i;
trace("exercizeServer starting\n");
if (winetest_debug > 1) trace("exercizeServer starting\n");
for (i = 0; i < NB_SERVER_LOOPS; i++) {
HANDLE hFile=INVALID_HANDLE_VALUE;
static const char obuf[] = "Bit Bucket";
......@@ -1258,7 +1258,7 @@ static void exercizeServer(const char *pipename, HANDLE serverThread)
for (loop = 0; loop < 3; loop++) {
DWORD err;
trace("Client connecting...\n");
if (winetest_debug > 1) trace("Client connecting...\n");
/* Connect to the server */
hFile = CreateFileA(pipename, GENERIC_READ | GENERIC_WRITE, 0,
NULL, OPEN_EXISTING, 0, 0);
......@@ -1269,28 +1269,28 @@ static void exercizeServer(const char *pipename, HANDLE serverThread)
ok(err == ERROR_PIPE_BUSY || err == ERROR_FILE_NOT_FOUND, "connecting to pipe\n");
else
ok(err == ERROR_PIPE_BUSY, "connecting to pipe\n");
trace("connect failed, retrying\n");
if (winetest_debug > 1) trace("connect failed, retrying\n");
Sleep(200);
}
ok(hFile != INVALID_HANDLE_VALUE, "client opening named pipe\n");
/* Make sure it can echo */
memset(ibuf, 0, sizeof(ibuf));
trace("Client writing...\n");
if (winetest_debug > 1) trace("Client writing...\n");
ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL), "WriteFile to client end of pipe\n");
ok(written == sizeof(obuf), "write file len\n");
trace("Client reading...\n");
if (winetest_debug > 1) trace("Client reading...\n");
ok(ReadFile(hFile, ibuf, sizeof(obuf), &readden, NULL), "ReadFile from client end of pipe\n");
ok(readden == sizeof(obuf), "read file len\n");
ok(memcmp(obuf, ibuf, written) == 0, "content check\n");
trace("Client closing...\n");
if (winetest_debug > 1) trace("Client closing...\n");
ok(CloseHandle(hFile), "CloseHandle\n");
}
ok(WaitForSingleObject(serverThread,INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject\n");
CloseHandle(hnp);
trace("exercizeServer returning\n");
if (winetest_debug > 1) trace("exercizeServer returning\n");
}
static void test_NamedPipe_2(void)
......@@ -1344,7 +1344,7 @@ static void test_NamedPipe_2(void)
ok(SetEvent( alarm_event ), "SetEvent\n");
CloseHandle( alarm_event );
trace("test_NamedPipe_2 returning\n");
if (winetest_debug > 1) trace("test_NamedPipe_2 returning\n");
}
static int test_DisconnectNamedPipe(void)
......
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