diff --git a/modules/rostests/rosautotest/CWineTest.cpp b/modules/rostests/rosautotest/CWineTest.cpp index 7175f7ec023..4ca9567fbf4 100644 --- a/modules/rostests/rosautotest/CWineTest.cpp +++ b/modules/rostests/rosautotest/CWineTest.cpp @@ -64,11 +64,27 @@ CWineTest::GetNextFile() WIN32_FIND_DATAW fd; /* Did we already begin searching for files? */ - if(m_hFind) + if (m_hFind) { /* Then get the next file (if any) */ - if(FindNextFileW(m_hFind, &fd)) - FoundFile = true; + if (FindNextFileW(m_hFind, &fd)) + { + // printf("cFileName is '%S'.\n", fd.cFileName); + /* If it was NOT rosautotest.exe then proceed as normal */ + if (_wcsicmp(fd.cFileName, TestName) != 0) + { + FoundFile = true; + } + else + { + /* It was rosautotest.exe so get the next file (if any) */ + if (FindNextFileW(m_hFind, &fd)) + { + FoundFile = true; + } + // printf("cFileName is '%S'.\n", fd.cFileName); + } + } } else { @@ -91,8 +107,25 @@ CWineTest::GetNextFile() /* Search for the first file and check whether we got one */ m_hFind = FindFirstFileW(FindPath.c_str(), &fd); - if(m_hFind != INVALID_HANDLE_VALUE) - FoundFile = true; + /* If we returned a good handle */ + if (m_hFind != INVALID_HANDLE_VALUE) + { + // printf("cFileName is '%S'.\n", fd.cFileName); + /* If it was NOT rosautotest.exe then proceed as normal */ + if (_wcsicmp(fd.cFileName, TestName) != 0) + { + FoundFile = true; + } + else + { + /* It was rosautotest.exe so get the next file (if any) */ + if (FindNextFileW(m_hFind, &fd)) + { + FoundFile = true; + } + // printf("cFileName is '%S'.\n", fd.cFileName); + } + } } if(FoundFile) diff --git a/modules/rostests/rosautotest/main.cpp b/modules/rostests/rosautotest/main.cpp index e808d5da91a..7965d2f9aa6 100644 --- a/modules/rostests/rosautotest/main.cpp +++ b/modules/rostests/rosautotest/main.cpp @@ -10,6 +10,8 @@ #include #include +WCHAR TestName[MAX_PATH]; + CConfiguration Configuration; /** @@ -87,6 +89,14 @@ extern "C" int wmain(int argc, wchar_t* argv[]) { int ReturnValue = 1; + DWORD TestStartTime, TestEndTime; + + GetModuleFileNameW(NULL, TestName, _countof(TestName)); +// printf("Full TestName is '%S'\n", TestName); + WCHAR* Name = wcsrchr(TestName, '\\'); + if (Name) + memmove(TestName, Name + 1, (wcslen(Name + 1) + 1) * sizeof(WCHAR)); +// printf("Short TestName is '%S'.\n", TestName); SetNtGlobalFlags(); @@ -99,6 +109,7 @@ wmain(int argc, wchar_t* argv[]) Configuration.GetSystemInformation(); Configuration.GetConfigurationFromFile(); + TestStartTime = GetTickCount(); ss << endl << endl << "[ROSAUTOTEST] System uptime " << setprecision(2) << fixed; @@ -139,6 +150,23 @@ wmain(int argc, wchar_t* argv[]) WineTest.Run(); } + /* Clear the stringstream */ + ss.str(""); + ss.clear(); + + /* Show the beginning time again */ + ss << "[ROSAUTOTEST] System uptime at start was " << setprecision(2) << fixed; + ss << ((float)TestStartTime / 1000) << " seconds" << endl; + + /* Show the time now so that we can see how long the tests took */ + TestEndTime = GetTickCount(); + ss << endl + << "[ROSAUTOTEST] System uptime at end was " << setprecision(2) << fixed; + ss << ((float)TestEndTime / 1000) << " seconds" << endl; + ss << "[ROSAUTOTEST] Duration was " << (((float)TestEndTime - (float)TestStartTime) / 1000) / 60; + ss << " minutes" << endl; + StringOut(ss.str()); + /* For sysreg2 */ DbgPrint("SYSREG_CHECKPOINT:THIRDBOOT_COMPLETE\n"); diff --git a/modules/rostests/rosautotest/precomp.h b/modules/rostests/rosautotest/precomp.h index 5e0f05b5794..a9157b86842 100644 --- a/modules/rostests/rosautotest/precomp.h +++ b/modules/rostests/rosautotest/precomp.h @@ -80,4 +80,6 @@ string StringOut(const string& String, bool forcePrint = true); string UnicodeToAscii(PCWSTR UnicodeString); string UnicodeToAscii(const wstring& UnicodeString); +extern WCHAR TestName[MAX_PATH]; + #endif /* _ROSAUTOTEST_H_ */