Commit 26cd1cc6 by Jamie Madill Committed by Commit Bot

Perf Tests: Add stdout printing arg to bot mode.

This can be useful for debugging and also for perf tests. The perf tests output gets scraped from stdout. Bug: angleproject:5124 Change-Id: Id5005df3f2b66be9497a9ba422abd47b95a1a330 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2486097Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 9d160b0b
...@@ -41,6 +41,7 @@ constexpr char kFilterFileArg[] = "--filter-file="; ...@@ -41,6 +41,7 @@ constexpr char kFilterFileArg[] = "--filter-file=";
constexpr char kResultFileArg[] = "--results-file="; constexpr char kResultFileArg[] = "--results-file=";
constexpr char kHistogramJsonFileArg[] = "--histogram-json-file="; constexpr char kHistogramJsonFileArg[] = "--histogram-json-file=";
constexpr char kListTests[] = "--gtest_list_tests"; constexpr char kListTests[] = "--gtest_list_tests";
constexpr char kPrintTestStdout[] = "--print-test-stdout";
#if defined(NDEBUG) #if defined(NDEBUG)
constexpr int kDefaultTestTimeout = 20; constexpr int kDefaultTestTimeout = 20;
#else #else
...@@ -52,7 +53,7 @@ constexpr int kDefaultBatchTimeout = 240; ...@@ -52,7 +53,7 @@ constexpr int kDefaultBatchTimeout = 240;
constexpr int kDefaultBatchTimeout = 600; constexpr int kDefaultBatchTimeout = 600;
#endif #endif
constexpr int kDefaultBatchSize = 256; constexpr int kDefaultBatchSize = 256;
constexpr double kIdleMessageTimeout = 10.0; constexpr double kIdleMessageTimeout = 15.0;
constexpr int kDefaultMaxProcesses = 16; constexpr int kDefaultMaxProcesses = 16;
const char *ParseFlagValue(const char *flag, const char *argument) const char *ParseFlagValue(const char *flag, const char *argument)
...@@ -641,7 +642,6 @@ void PrintTestOutputSnippet(const TestIdentifier &id, ...@@ -641,7 +642,6 @@ void PrintTestOutputSnippet(const TestIdentifier &id,
{ {
std::cout << fullOutput.substr(runPos); std::cout << fullOutput.substr(runPos);
} }
std::cout << "\n";
} }
std::string GetConfigNameFromTestIdentifier(const TestIdentifier &id) std::string GetConfigNameFromTestIdentifier(const TestIdentifier &id)
...@@ -800,6 +800,7 @@ TestSuite::TestSuite(int *argc, char **argv) ...@@ -800,6 +800,7 @@ TestSuite::TestSuite(int *argc, char **argv)
mBotMode(false), mBotMode(false),
mDebugTestGroups(false), mDebugTestGroups(false),
mListTests(false), mListTests(false),
mPrintTestStdout(false),
mBatchSize(kDefaultBatchSize), mBatchSize(kDefaultBatchSize),
mCurrentResultCount(0), mCurrentResultCount(0),
mTotalResultCount(0), mTotalResultCount(0),
...@@ -1042,7 +1043,8 @@ bool TestSuite::parseSingleArg(const char *argument) ...@@ -1042,7 +1043,8 @@ bool TestSuite::parseSingleArg(const char *argument)
ParseStringArg("--isolated-script-test-perf-output=", argument, &mHistogramJsonFile) || ParseStringArg("--isolated-script-test-perf-output=", argument, &mHistogramJsonFile) ||
ParseFlag("--bot-mode", argument, &mBotMode) || ParseFlag("--bot-mode", argument, &mBotMode) ||
ParseFlag("--debug-test-groups", argument, &mDebugTestGroups) || ParseFlag("--debug-test-groups", argument, &mDebugTestGroups) ||
ParseFlag(kListTests, argument, &mListTests)); ParseFlag(kListTests, argument, &mListTests) ||
ParseFlag(kPrintTestStdout, argument, &mPrintTestStdout));
} }
void TestSuite::onCrashOrTimeout(TestResultType crashOrTimeout) void TestSuite::onCrashOrTimeout(TestResultType crashOrTimeout)
...@@ -1201,10 +1203,16 @@ bool TestSuite::finishProcess(ProcessInfo *processInfo) ...@@ -1201,10 +1203,16 @@ bool TestSuite::finishProcess(ProcessInfo *processInfo)
} }
mCurrentResultCount++; mCurrentResultCount++;
printf("[%d/%d] %s.%s", mCurrentResultCount, mTotalResultCount, id.testSuiteName.c_str(), printf("[%d/%d] %s.%s", mCurrentResultCount, mTotalResultCount, id.testSuiteName.c_str(),
id.testName.c_str()); id.testName.c_str());
if (result.type == TestResultType::Pass) if (mPrintTestStdout)
{
const std::string &batchStdout = processInfo->process->getStdout();
PrintTestOutputSnippet(id, result, batchStdout);
}
else if (result.type == TestResultType::Pass)
{ {
printf(" (%0.1lf ms)\n", result.elapsedTimeSeconds * 1000.0); printf(" (%0.1lf ms)\n", result.elapsedTimeSeconds * 1000.0);
} }
...@@ -1271,7 +1279,6 @@ int TestSuite::run() ...@@ -1271,7 +1279,6 @@ int TestSuite::run()
{ {
startWatchdog(); startWatchdog();
} }
int retVal = RUN_ALL_TESTS(); int retVal = RUN_ALL_TESTS();
{ {
...@@ -1351,7 +1358,11 @@ int TestSuite::run() ...@@ -1351,7 +1358,11 @@ int TestSuite::run()
} }
} }
if (!progress && messageTimer.getElapsedTime() > kIdleMessageTimeout) if (progress)
{
messageTimer.start();
}
else if (messageTimer.getElapsedTime() > kIdleMessageTimeout)
{ {
const ProcessInfo &processInfo = mCurrentProcesses[0]; const ProcessInfo &processInfo = mCurrentProcesses[0];
double processTime = processInfo.process->getElapsedTimeSeconds(); double processTime = processInfo.process->getElapsedTimeSeconds();
......
...@@ -144,6 +144,7 @@ class TestSuite ...@@ -144,6 +144,7 @@ class TestSuite
bool mBotMode; bool mBotMode;
bool mDebugTestGroups; bool mDebugTestGroups;
bool mListTests; bool mListTests;
bool mPrintTestStdout;
int mBatchSize; int mBatchSize;
int mCurrentResultCount; int mCurrentResultCount;
int mTotalResultCount; int mTotalResultCount;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment