+ Args.Test = Current;
+
+ /* Get name of test */
+ memset(Name, 0, sizeof(Name));
+
+ _Result = TS_OK;
+ _Buffer = Name;
+ (Current->Routine)(TESTCMD_TESTNAME);
+ if (_Result != TS_OK)
+ {
+ if (TestName != NULL)
+ {
+ continue;
+ }
+ strcpy(Name, "Unnamed");
+ }
+
+ if (TestName != NULL)
+ {
+ if (_stricmp(Name, TestName) != 0)
+ {
+ continue;
+ }
+ }
+
+ /* Get timeout for test */
+ TimeOut = 0;
+ _Result = TS_OK;
+ _Buffer = (char *)&TimeOut;
+ (Current->Routine)(TESTCMD_TIMEOUT);
+ if (_Result != TS_OK || TimeOut == INFINITE)
+ {
+ TimeOut = 5000;
+ }
+
+ /* Run test in thread */
+ hThread = _CreateThread(NULL, 0, PerformTest, (PVOID)&Args, 0, NULL);
+ if (hThread == NULL)
+ {
+ sprintf(OutputBuffer,
+ "ROSREGTEST: |%s| Status: Failed (CreateThread failed: 0x%x)\n",
+ Name, (unsigned int)GetLastError());
+ }
+ else if (_WaitForSingleObject(hThread, TimeOut) == WAIT_TIMEOUT)
+ {
+ if (!_TerminateThread(hThread, 0))
+ {
+ sprintf(OutputBuffer,
+ "ROSREGTEST: |%s| Status: Failed (Test timed out - %d ms, TerminateThread failed: 0x%x)\n",
+ Name, (int)TimeOut, (unsigned int)GetLastError());
+ }
+ else
+ {
+ sprintf(OutputBuffer, "ROSREGTEST: |%s| Status: Failed (Test timed out - %d ms)\n", Name, (int)TimeOut);
+ }
+ }
+ else
+ {
+ continue;
+ }
+
+ if (OutputRoutine != NULL)
+ {
+ (*OutputRoutine)(OutputBuffer);
+ }
+ else
+ {
+ DbgPrint(OutputBuffer);
+ }