Make the dEQP GTEST initialization failures red on swarming.

On swarming the dEQP GTEST initialization failures would show as green
because the FAIL GTEST macro was called outside of a test. Use exit(-1)
instead that shows up as red on the bots.

BUG=580045

Change-Id: Icf82a8593a11fe7e992778ffd8c682f6738c39a6
Reviewed-on: https://chromium-review.googlesource.com/326690
Reviewed-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Corentin Wallez 2016-02-08 14:02:52 -05:00
Родитель 3f16afd389
Коммит a78d12c5e4
1 изменённых файлов: 17 добавлений и 5 удалений

Просмотреть файл

@ -41,7 +41,15 @@ const char *g_TestExpectationsFiles[] =
"deqp_egl_test_expectations.txt",
};
Optional<std::string> FindTestExpectationsPath(const std::string &exeDir, size_t testModuleIndex)
// During the CaseList initialization we cannot use the GTEST FAIL macro to quit the program because
// the initialization is called outside of tests the first time.
void Die()
{
exit(EXIT_FAILURE);
}
Optional<std::string> FindTestExpectationsPath(const std::string &exeDir,
size_t testModuleIndex)
{
for (const char *testPath : g_TestExpectationsSearchPaths)
{
@ -128,7 +136,8 @@ void dEQPCaseList::initialize()
Optional<std::string> testExpectationsPath = FindTestExpectationsPath(exeDir, mTestModuleIndex);
if (!testExpectationsPath.valid())
{
FAIL() << "Failed to find test expectations file.";
std::cerr << "Failed to find test expectations file." << std::endl;
Die();
}
if (!mTestExpectationsParser.LoadTestExpectationsFromFile(testExpectationsPath.value()))
@ -139,18 +148,21 @@ void dEQPCaseList::initialize()
errorMsgStream << std::endl << " " << message;
}
FAIL() << "Failed to load test expectations." << errorMsgStream.str();
std::cerr << "Failed to load test expectations." << errorMsgStream.str() << std::endl;
Die();
}
if (!mTestConfig.LoadCurrentConfig(nullptr))
{
FAIL() << "Failed to load test configuration.";
std::cerr << "Failed to load test configuration." << std::endl;
Die();
}
std::ifstream caseListStream(caseListPath);
if (caseListStream.fail())
{
FAIL() << "Failed to load the case list.";
std::cerr << "Failed to load the case list." << std::endl;
Die();
}
while (!caseListStream.eof())