mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:32:57 +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 <hermes.belusca-maito@reactos.org>
This commit is contained in:
parent
d66ad21ee0
commit
7afcd2a8b7
3 changed files with 68 additions and 5 deletions
|
@ -64,13 +64,29 @@ CWineTest::GetNextFile()
|
||||||
WIN32_FIND_DATAW fd;
|
WIN32_FIND_DATAW fd;
|
||||||
|
|
||||||
/* Did we already begin searching for files? */
|
/* Did we already begin searching for files? */
|
||||||
if(m_hFind)
|
if (m_hFind)
|
||||||
{
|
{
|
||||||
/* Then get the next file (if any) */
|
/* Then get the next file (if any) */
|
||||||
if(FindNextFileW(m_hFind, &fd))
|
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;
|
FoundFile = true;
|
||||||
}
|
}
|
||||||
else
|
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
|
||||||
{
|
{
|
||||||
/* Start searching for test files */
|
/* Start searching for test files */
|
||||||
wstring FindPath = m_TestPath;
|
wstring FindPath = m_TestPath;
|
||||||
|
@ -91,9 +107,26 @@ CWineTest::GetNextFile()
|
||||||
/* Search for the first file and check whether we got one */
|
/* Search for the first file and check whether we got one */
|
||||||
m_hFind = FindFirstFileW(FindPath.c_str(), &fd);
|
m_hFind = FindFirstFileW(FindPath.c_str(), &fd);
|
||||||
|
|
||||||
if(m_hFind != INVALID_HANDLE_VALUE)
|
/* 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;
|
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)
|
if(FoundFile)
|
||||||
m_CurrentFile = fd.cFileName;
|
m_CurrentFile = fd.cFileName;
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include <ndk/setypes.h>
|
#include <ndk/setypes.h>
|
||||||
#include <ndk/exfuncs.h>
|
#include <ndk/exfuncs.h>
|
||||||
|
|
||||||
|
WCHAR TestName[MAX_PATH];
|
||||||
|
|
||||||
CConfiguration Configuration;
|
CConfiguration Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,6 +89,14 @@ extern "C" int
|
||||||
wmain(int argc, wchar_t* argv[])
|
wmain(int argc, wchar_t* argv[])
|
||||||
{
|
{
|
||||||
int ReturnValue = 1;
|
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();
|
SetNtGlobalFlags();
|
||||||
|
|
||||||
|
@ -99,6 +109,7 @@ wmain(int argc, wchar_t* argv[])
|
||||||
Configuration.GetSystemInformation();
|
Configuration.GetSystemInformation();
|
||||||
Configuration.GetConfigurationFromFile();
|
Configuration.GetConfigurationFromFile();
|
||||||
|
|
||||||
|
TestStartTime = GetTickCount();
|
||||||
ss << endl
|
ss << endl
|
||||||
<< endl
|
<< endl
|
||||||
<< "[ROSAUTOTEST] System uptime " << setprecision(2) << fixed;
|
<< "[ROSAUTOTEST] System uptime " << setprecision(2) << fixed;
|
||||||
|
@ -139,6 +150,23 @@ wmain(int argc, wchar_t* argv[])
|
||||||
WineTest.Run();
|
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 */
|
/* For sysreg2 */
|
||||||
DbgPrint("SYSREG_CHECKPOINT:THIRDBOOT_COMPLETE\n");
|
DbgPrint("SYSREG_CHECKPOINT:THIRDBOOT_COMPLETE\n");
|
||||||
|
|
||||||
|
|
|
@ -80,4 +80,6 @@ string StringOut(const string& String, bool forcePrint = true);
|
||||||
string UnicodeToAscii(PCWSTR UnicodeString);
|
string UnicodeToAscii(PCWSTR UnicodeString);
|
||||||
string UnicodeToAscii(const wstring& UnicodeString);
|
string UnicodeToAscii(const wstring& UnicodeString);
|
||||||
|
|
||||||
|
extern WCHAR TestName[MAX_PATH];
|
||||||
|
|
||||||
#endif /* _ROSAUTOTEST_H_ */
|
#endif /* _ROSAUTOTEST_H_ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue