Windows: WinTorture Verbose mode display all logged messages

In verbose mode, wintorture should send to stdout all logged
messages.

LICENSE MIT

Change-Id: I4e173c35fcf6b1284d31149d773308b9f9c9a773
Reviewed-on: http://gerrit.openafs.org/1696
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
Jeffrey Altman 2010-04-05 11:24:16 -04:00 committed by Jeffrey Altman
parent eb25c5b1c3
commit 10884e7354
2 changed files with 32 additions and 0 deletions

View File

@ -180,6 +180,8 @@ DWORD WINAPI StressTestThread(LPVOID lpThreadParameter)
if (LastKnownError != ERROR_NETNAME_DELETED)
break;
sprintf(temp, "entered error %d processing\n", LastKnownError);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
count = strlen(pExitStatus->Reason);
@ -211,6 +213,8 @@ DWORD WINAPI StressTestThread(LPVOID lpThreadParameter)
Sleep(10 * 1000);
}
sprintf(temp, "leaving error 0x%x processing\n", LastKnownError);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
if (count > 3)
break;
@ -277,9 +281,13 @@ BOOL run_netbench(int client, char *ClientText, char *PathToSecondDir)
sprintf(temp, "Started Iteration %d\n", CurrentLoop);
sprintf(FileName, "Thread_%05d.log", ProcessNumber);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
sprintf(temp, "Thread %d started\n", ProcessNumber);
sprintf(FileName, "Thread_%05d.log", ProcessNumber);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
hFile = CreateFile(ClientText, GENERIC_READ | STANDARD_RIGHTS_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@ -318,16 +326,22 @@ BOOL run_netbench(int client, char *ClientText, char *PathToSecondDir)
{
strcpy(temp, "AFS suspend request received\n");
sprintf(FileName, "Thread_%05d.log", ProcessNumber);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
while (WaitForSingleObject(ContinueEventHandle, 5000) == WAIT_TIMEOUT);
strcpy(temp, "AFS continue request received\n");
sprintf(FileName, "Thread_%05d.log", ProcessNumber);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
}
if (rc = WaitForSingleObject(ShutDownEventHandle, 0) == WAIT_OBJECT_0)
{
strcpy(temp, "AFS shutdown request received\n");
sprintf(FileName, "Thread_%05d.log", ProcessNumber);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
break;
}

View File

@ -153,6 +153,8 @@ int nb_Xrmdir(char *Directory, char *type)
sprintf(temp, "rmdir failed on %s\n", command);
LeaveThread(rc, temp, CMD_XRMDIR);
sprintf(temp, "FAILURE: Thread %d - Xrmdir failed on \"%s\"\n", ProcessNumber, command);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
return(-1);
}
@ -188,6 +190,8 @@ int nb_Mkdir(char *Directory)
sprintf(temp, "mkdir failed on %s\n", command);
LeaveThread(rc, temp, CMD_MKDIR);
sprintf(temp, "ERROR: Thread %d - mkdir failed on \"%s\"\n", ProcessNumber, command);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
return(-1);
}
@ -226,6 +230,8 @@ int nb_Attach(char *Locker, char *Drive)
sprintf(pExitStatus->Reason, "attach failed on %s\n", command);
pExitStatus->ExitStatus = rc;
sprintf(temp, "ERROR: Thread %d - attach failed on \"%s\"\n", ProcessNumber, command);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
}
EndFirstTimer(CMD_ATTACH, 1);
@ -266,6 +272,8 @@ int nb_Detach(char *Name, char *type)
sprintf(temp, "detach failed on %s\n", command);
LeaveThread(rc, temp, CMD_DETACH);
sprintf(temp, "ERROR: Thread %d - detach failed on \"%s\"\n", ProcessNumber, command);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
return(-1);
}
@ -309,6 +317,8 @@ int nb_CreateFile(char *path, DWORD size)
sprintf(temp, "Create file failed on \"%s\" GLE(0x%x)\n", NewPath, gle);
LeaveThread(0, temp, CMD_CREATEFILE);
sprintf(temp, "ERROR: Thread %d - Create file failed on \"%s\" GLE(0x%x)\n", ProcessNumber, NewPath, gle);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
return(-1);
}
@ -392,6 +402,8 @@ int nb_DeleteFile(char *path)
sprintf(temp, "del failed on \"%s\"\n", NewPath);
LeaveThread(rc, temp, CMD_DELETEFILES);
sprintf(temp, "ERROR: Thread %d - del failed on \"%s\"\n", ProcessNumber, command);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
return(-1);
}
@ -427,6 +439,8 @@ int nb_xcopy(char *Source, char *Destination)
sprintf(temp, "xcopy failed on %s\n", command);
LeaveThread((int)rc, temp, CMD_XCOPY);
sprintf(temp, "FAIURE: Thread %d - xcopy failed on \"%s\"\n", ProcessNumber, command);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
return(-1);
}
@ -461,6 +475,8 @@ int nb_Move(char *Source, char *Destination)
sprintf(temp, "move failed on \"%s\"\n", command);
LeaveThread(rc, temp, CMD_MOVE);
sprintf(temp, "FAILURE: Thread %d - move failed on \"%s\"\n", ProcessNumber, command);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
return(-1);
}
@ -584,6 +600,8 @@ int nb_writex(int handle, int offset, int size, int ret_size)
if (verbose)
printf("%s", temp);
nb_close(handle);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
return(-1);
}