mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[ROSAUTOTEST] Allow rosautotest to be in the same directory as its files and show its duration at the end. (#7823)
Example output: [ROSAUTOTEST] System uptime 7.41 seconds ... Testing here... [ROSAUTOTEST] System uptime at start was 7.41 seconds [ROSAUTOTEST] System uptime at end was 1546.20 seconds [ROSAUTOTEST] Duration was 25.65 minutes Co-authored-by: Hermès BÉLUSCA - MAÏTO <[email protected]>
This commit is contained in:
co-authored by
Hermès BÉLUSCA - MAÏTO
parent
d66ad21ee0
commit
7afcd2a8b7
@@ -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)
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <ndk/setypes.h>
|
||||
#include <ndk/exfuncs.h>
|
||||
|
||||
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");
|
||||
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
Reference in New Issue
Block a user