Commit e5c5efc0 by Jamie Madill

Revert "Test Runner: Pick single/multi-process mode automatically."

This reverts commit 573d7f34. Reason for revert: Breaking ANGLE roll. No-try: true Original change's description: > Test Runner: Pick single/multi-process mode automatically. > > This enables multi-process when running with more than one test > config. This saves developers from remembering to add the arg. > It can also simplify our test configurations by allowing us to omit > the default arguments. On Android by default we stay with single > process. It also changes the --bot-mode flag into --single-process > and --multi-process which override the default behaviour. > > Bug: angleproject:5585 > Change-Id: I3dd885a8a8e6604c224693c546ff5d15224e016e > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2664246 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> > Reviewed-by: Kenneth Russell <kbr@chromium.org> > Commit-Queue: Jamie Madill <jmadill@chromium.org> TBR=kbr@chromium.org,syoussefi@chromium.org,jonahr@google.com,jmadill@chromium.org,jonahr@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: angleproject:5585 Change-Id: I11ee1034c301aa246c4b03e29ff9b56235a1005c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2676247Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent af70ceac
...@@ -121,17 +121,6 @@ bool ParseFlag(const char *expected, const char *actual, bool *flagOut) ...@@ -121,17 +121,6 @@ bool ParseFlag(const char *expected, const char *actual, bool *flagOut)
return false; return false;
} }
template <typename SetterFuncT>
bool ParseFlagCustom(const char *expected, const char *actual, SetterFuncT setterFunc)
{
if (strcmp(expected, actual) == 0)
{
setterFunc();
return true;
}
return false;
}
bool ParseStringArg(const char *flag, const char *argument, std::string *valueOut) bool ParseStringArg(const char *flag, const char *argument, std::string *valueOut)
{ {
const char *value = ParseFlagValue(flag, argument); const char *value = ParseFlagValue(flag, argument);
...@@ -978,44 +967,6 @@ void GTestListTests(const std::map<TestIdentifier, TestResult> &resultsMap) ...@@ -978,44 +967,6 @@ void GTestListTests(const std::map<TestIdentifier, TestResult> &resultsMap)
} }
} }
} }
ANGLE_MAYBE_UNUSED std::set<std::string> GetUniqueTestConfigs(
const std::vector<TestIdentifier> &testIdentifiers)
{
std::set<std::string> uniqueConfigNames;
for (const TestIdentifier &id : testIdentifiers)
{
std::string config = GetConfigNameFromTestIdentifier(id);
uniqueConfigNames.insert(config);
}
return uniqueConfigNames;
}
TestSuiteRunMode DetermineTestSuiteRunMode(const std::vector<TestIdentifier> &testSet, int batchId)
{
#if defined(ANGLE_PLATFORM_ANDROID)
// TODO: Run single config per process on Android. http://anglebug.com/5600
return TestSuiteRunMode::SingleProcess;
#else
// Run single-process if in a child batch.
if (batchId != -1)
{
return TestSuiteRunMode::SingleProcess;
}
// If more than one config, enable multi-process by default.
// Also use multi-process if we only have the single default config.
std::set<std::string> testConfigs = GetUniqueTestConfigs(testSet);
if ((testConfigs.size() == 1) && (*testConfigs.begin() != "default"))
{
return TestSuiteRunMode::SingleProcess;
}
else
{
return TestSuiteRunMode::MultiProcess;
}
#endif // defined(ANGLE_PLATFORM_ANDROID)
}
} // namespace } // namespace
// static // static
...@@ -1079,7 +1030,7 @@ ProcessInfo::ProcessInfo(ProcessInfo &&other) ...@@ -1079,7 +1030,7 @@ ProcessInfo::ProcessInfo(ProcessInfo &&other)
TestSuite::TestSuite(int *argc, char **argv) TestSuite::TestSuite(int *argc, char **argv)
: mShardCount(-1), : mShardCount(-1),
mShardIndex(-1), mShardIndex(-1),
mRunMode(TestSuiteRunMode::Unspecified), mBotMode(false),
mDebugTestGroups(false), mDebugTestGroups(false),
mGTestListTests(false), mGTestListTests(false),
mListTests(false), mListTests(false),
...@@ -1222,12 +1173,6 @@ TestSuite::TestSuite(int *argc, char **argv) ...@@ -1222,12 +1173,6 @@ TestSuite::TestSuite(int *argc, char **argv)
std::vector<TestIdentifier> testSet = GetFilteredTests(&mTestFileLines, alsoRunDisabledTests); std::vector<TestIdentifier> testSet = GetFilteredTests(&mTestFileLines, alsoRunDisabledTests);
if (mRunMode == TestSuiteRunMode::Unspecified)
{
mRunMode = DetermineTestSuiteRunMode(testSet, mBatchId);
ASSERT(mRunMode != TestSuiteRunMode::Unspecified);
}
if (mShardCount == 0) if (mShardCount == 0)
{ {
printf("Shard count must be > 0.\n"); printf("Shard count must be > 0.\n");
...@@ -1247,7 +1192,7 @@ TestSuite::TestSuite(int *argc, char **argv) ...@@ -1247,7 +1192,7 @@ TestSuite::TestSuite(int *argc, char **argv)
testSet = GetShardTests(testSet, mShardIndex, mShardCount, &mTestFileLines, testSet = GetShardTests(testSet, mShardIndex, mShardCount, &mTestFileLines,
alsoRunDisabledTests); alsoRunDisabledTests);
if (mRunMode == TestSuiteRunMode::SingleProcess) if (!mBotMode)
{ {
mFilterString = GetTestFilter(testSet); mFilterString = GetTestFilter(testSet);
...@@ -1279,7 +1224,7 @@ TestSuite::TestSuite(int *argc, char **argv) ...@@ -1279,7 +1224,7 @@ TestSuite::TestSuite(int *argc, char **argv)
mTestResults.testArtifactsFakeTestName = fakeTestName.str(); mTestResults.testArtifactsFakeTestName = fakeTestName.str();
} }
if (mRunMode == TestSuiteRunMode::MultiProcess) if (mBotMode)
{ {
// Split up test batches. // Split up test batches.
mTestQueue = BatchTests(testSet, mBatchSize); mTestQueue = BatchTests(testSet, mBatchSize);
...@@ -1304,8 +1249,7 @@ TestSuite::TestSuite(int *argc, char **argv) ...@@ -1304,8 +1249,7 @@ TestSuite::TestSuite(int *argc, char **argv)
mTotalResultCount = testSet.size(); mTotalResultCount = testSet.size();
if ((mRunMode == TestSuiteRunMode::MultiProcess || !mResultsDirectory.empty()) && if ((mBotMode || !mResultsDirectory.empty()) && mResultsFile.empty())
mResultsFile.empty())
{ {
// Create a default output file in bot mode. // Create a default output file in bot mode.
mResultsFile = "output.json"; mResultsFile = "output.json";
...@@ -1318,7 +1262,7 @@ TestSuite::TestSuite(int *argc, char **argv) ...@@ -1318,7 +1262,7 @@ TestSuite::TestSuite(int *argc, char **argv)
mResultsFile = resultFileName.str(); mResultsFile = resultFileName.str();
} }
if (mRunMode == TestSuiteRunMode::SingleProcess) if (!mBotMode)
{ {
testing::TestEventListeners &listeners = testing::UnitTest::GetInstance()->listeners(); testing::TestEventListeners &listeners = testing::UnitTest::GetInstance()->listeners();
listeners.Append(new TestEventListener( listeners.Append(new TestEventListener(
...@@ -1360,10 +1304,7 @@ bool TestSuite::parseSingleArg(const char *argument) ...@@ -1360,10 +1304,7 @@ bool TestSuite::parseSingleArg(const char *argument)
ParseStringArg(kHistogramJsonFileArg, argument, &mHistogramJsonFile) || ParseStringArg(kHistogramJsonFileArg, argument, &mHistogramJsonFile) ||
ParseStringArg("--isolated-script-test-perf-output=", argument, &mHistogramJsonFile) || ParseStringArg("--isolated-script-test-perf-output=", argument, &mHistogramJsonFile) ||
ParseStringArg(kIsolatedOutDir, argument, &mTestArtifactDirectory) || ParseStringArg(kIsolatedOutDir, argument, &mTestArtifactDirectory) ||
ParseFlagCustom("--single-process", argument, ParseFlag("--bot-mode", argument, &mBotMode) ||
[this]() { this->mRunMode = TestSuiteRunMode::SingleProcess; }) ||
ParseFlagCustom("--multi-process", argument,
[this]() { this->mRunMode = TestSuiteRunMode::MultiProcess; }) ||
ParseFlag("--debug-test-groups", argument, &mDebugTestGroups) || ParseFlag("--debug-test-groups", argument, &mDebugTestGroups) ||
ParseFlag(kGTestListTests, argument, &mGTestListTests) || ParseFlag(kGTestListTests, argument, &mGTestListTests) ||
ParseFlag(kListTests, argument, &mListTests) || ParseFlag(kListTests, argument, &mListTests) ||
...@@ -1664,7 +1605,7 @@ int TestSuite::run() ...@@ -1664,7 +1605,7 @@ int TestSuite::run()
} }
// Run tests serially. // Run tests serially.
if (mRunMode == TestSuiteRunMode::SingleProcess) if (!mBotMode)
{ {
// Only start the watchdog if the debugger is not attached and we're a child process. // Only start the watchdog if the debugger is not attached and we're a child process.
if (!angle::IsDebuggerAttached() && mBatchId != -1) if (!angle::IsDebuggerAttached() && mBatchId != -1)
......
...@@ -119,13 +119,6 @@ struct ProcessInfo : angle::NonCopyable ...@@ -119,13 +119,6 @@ struct ProcessInfo : angle::NonCopyable
std::string filterString; std::string filterString;
}; };
enum class TestSuiteRunMode
{
Unspecified,
SingleProcess,
MultiProcess,
};
using TestQueue = std::queue<std::vector<TestIdentifier>>; using TestQueue = std::queue<std::vector<TestIdentifier>>;
class TestSuite class TestSuite
...@@ -171,7 +164,7 @@ class TestSuite ...@@ -171,7 +164,7 @@ class TestSuite
int mShardIndex; int mShardIndex;
angle::CrashCallback mCrashCallback; angle::CrashCallback mCrashCallback;
TestResults mTestResults; TestResults mTestResults;
TestSuiteRunMode mRunMode; bool mBotMode;
bool mDebugTestGroups; bool mDebugTestGroups;
bool mGTestListTests; bool mGTestListTests;
bool mListTests; bool mListTests;
......
...@@ -63,9 +63,9 @@ class TestSuiteTest : public testing::Test ...@@ -63,9 +63,9 @@ class TestSuiteTest : public testing::Test
std::string resultsFileName = "--results-file=" + mTempFileName; std::string resultsFileName = "--results-file=" + mTempFileName;
std::vector<const char *> args = {executablePath.c_str(), kRunTestSuite, std::vector<const char *> args = {
"--gtest_also_run_disabled_tests", "--test-timeout=5", executablePath.c_str(), kRunTestSuite, "--gtest_also_run_disabled_tests",
resultsFileName.c_str()}; "--bot-mode", "--test-timeout=5", resultsFileName.c_str()};
for (const std::string &arg : extraArgs) for (const std::string &arg : extraArgs)
{ {
......
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