Commit 5c4c37dc by Jamie Madill Committed by Commit Bot

Capture/Replay: Test improvements.

Streamlines some arguments. Use a common subdirectory in out/. Show process name when logging. Clean up environment variable handling. Bug: angleproject:5247 Change-Id: I85eb5b8194a64f90691c4d03db3ee65c5e9b2313 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2497560Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 218a939e
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// This will expand to "angle_capture_context<#>.h" // This will expand to "angle_capture_context<#>.h"
#include ANGLE_MACRO_STRINGIZE(ANGLE_CAPTURE_REPLAY_COMPOSITE_TESTS_HEADER) #include ANGLE_MACRO_STRINGIZE(ANGLE_CAPTURE_REPLAY_COMPOSITE_TESTS_HEADER)
const std::string resultTag = "*RESULT"; constexpr char kResultTag[] = "*RESULT";
class CaptureReplayTests class CaptureReplayTests
{ {
...@@ -144,7 +144,7 @@ class CaptureReplayTests ...@@ -144,7 +144,7 @@ class CaptureReplayTests
for (size_t i = 0; i < testTraceInfos.size(); i++) for (size_t i = 0; i < testTraceInfos.size(); i++)
{ {
int result = runTest(static_cast<uint32_t>(i), testTraceInfos[i]); int result = runTest(static_cast<uint32_t>(i), testTraceInfos[i]);
std::cout << resultTag << " " << testTraceInfos[i].testName << " " << result << "\n"; std::cout << kResultTag << " " << testTraceInfos[i].testName << " " << result << "\n";
} }
return 0; return 0;
} }
......
...@@ -40,7 +40,8 @@ constexpr char kTestTimeoutArg[] = "--test-timeout="; ...@@ -40,7 +40,8 @@ constexpr char kTestTimeoutArg[] = "--test-timeout=";
constexpr char kFilterFileArg[] = "--filter-file="; 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 kGTestListTests[] = "--gtest_list_tests";
constexpr char kListTests[] = "--list-tests";
constexpr char kPrintTestStdout[] = "--print-test-stdout"; constexpr char kPrintTestStdout[] = "--print-test-stdout";
constexpr char kBatchId[] = "--batch-id="; constexpr char kBatchId[] = "--batch-id=";
#if defined(NDEBUG) #if defined(NDEBUG)
...@@ -713,10 +714,23 @@ TestQueue BatchTests(const std::vector<TestIdentifier> &tests, int batchSize) ...@@ -713,10 +714,23 @@ TestQueue BatchTests(const std::vector<TestIdentifier> &tests, int batchSize)
return testQueue; return testQueue;
} }
void ListTests(const std::map<TestIdentifier, TestResult> &resultsMap)
{
std::map<std::string, std::vector<std::string>> suites;
std::cout << "Tests list:\n";
for (const auto &resultIt : resultsMap)
{
const TestIdentifier &id = resultIt.first;
std::cout << id << "\n";
}
}
// Prints the names of the tests matching the user-specified filter flag. // Prints the names of the tests matching the user-specified filter flag.
// This matches the output from googletest/src/gtest.cc but is much much faster for large filters. // This matches the output from googletest/src/gtest.cc but is much much faster for large filters.
// See http://anglebug.com/5164 // See http://anglebug.com/5164
void ListTests(const std::map<TestIdentifier, TestResult> &resultsMap) void GTestListTests(const std::map<TestIdentifier, TestResult> &resultsMap)
{ {
std::map<std::string, std::vector<std::string>> suites; std::map<std::string, std::vector<std::string>> suites;
...@@ -806,6 +820,7 @@ TestSuite::TestSuite(int *argc, char **argv) ...@@ -806,6 +820,7 @@ TestSuite::TestSuite(int *argc, char **argv)
mShardIndex(-1), mShardIndex(-1),
mBotMode(false), mBotMode(false),
mDebugTestGroups(false), mDebugTestGroups(false),
mGTestListTests(false),
mListTests(false), mListTests(false),
mPrintTestStdout(false), mPrintTestStdout(false),
mBatchSize(kDefaultBatchSize), mBatchSize(kDefaultBatchSize),
...@@ -1052,6 +1067,7 @@ bool TestSuite::parseSingleArg(const char *argument) ...@@ -1052,6 +1067,7 @@ 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(kGTestListTests, argument, &mGTestListTests) ||
ParseFlag(kListTests, argument, &mListTests) || ParseFlag(kListTests, argument, &mListTests) ||
ParseFlag(kPrintTestStdout, argument, &mPrintTestStdout)); ParseFlag(kPrintTestStdout, argument, &mPrintTestStdout));
} }
...@@ -1281,6 +1297,12 @@ int TestSuite::run() ...@@ -1281,6 +1297,12 @@ int TestSuite::run()
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
if (mGTestListTests)
{
GTestListTests(mTestResults.results);
return EXIT_SUCCESS;
}
// Run tests serially. // Run tests serially.
if (!mBotMode) if (!mBotMode)
{ {
......
...@@ -143,6 +143,7 @@ class TestSuite ...@@ -143,6 +143,7 @@ class TestSuite
TestResults mTestResults; TestResults mTestResults;
bool mBotMode; bool mBotMode;
bool mDebugTestGroups; bool mDebugTestGroups;
bool mGTestListTests;
bool mListTests; bool mListTests;
bool mPrintTestStdout; bool mPrintTestStdout;
int mBatchSize; int mBatchSize;
......
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