Add command line option to filter by test config.

This allows us to run angle_end2end_tests with a single config without
using gtest_filter. It will also allow us to run each test config in
a separate process.

Bug: angleproject:3393
Change-Id: I09aaf9cfe55a117b0af8d79ecfd129f3d0f1d7c8
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1591427
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
This commit is contained in:
Jamie Madill 2019-05-03 12:52:21 -04:00 коммит произвёл Commit Bot
Родитель 051b0896a7
Коммит 97f0affbbd
4 изменённых файлов: 40 добавлений и 14 удалений

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

@ -10,8 +10,8 @@ void ANGLEProcessTestArgs(int *argc, char *argv[]);
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
ANGLEProcessTestArgs(&argc, argv);
testing::InitGoogleTest(&argc, argv);
int rt = RUN_ALL_TESTS();
return rt;
}

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

@ -292,6 +292,8 @@ TestPlatformContext gPlatformContext;
// After a fixed number of iterations we reset the test window. This works around some driver bugs.
constexpr uint32_t kWindowReuseLimit = 50;
constexpr char kUseConfig[] = "--use-config=";
} // anonymous namespace
// static
@ -1277,6 +1279,14 @@ angle::Library *ANGLETestEnvironment::GetWGLLibrary()
void ANGLEProcessTestArgs(int *argc, char *argv[])
{
testing::AddGlobalTestEnvironment(new ANGLETestEnvironment());
for (int argIndex = 1; argIndex < *argc; argIndex++)
{
if (strncmp(argv[argIndex], kUseConfig, strlen(kUseConfig)) == 0)
{
angle::gSelectedConfig = std::string(argv[argIndex] + strlen(kUseConfig));
}
}
}
EGLTest::EGLTest() = default;

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

@ -69,6 +69,8 @@ bool IsNativeConfigSupported(const PlatformParameters &param, OSWindow *osWindow
}
} // namespace
std::string gSelectedConfig;
SystemInfo *GetTestSystemInfo()
{
static SystemInfo *sSystemInfo = nullptr;
@ -412,11 +414,22 @@ bool IsPlatformAvailable(const PlatformParameters &param)
{
return iter->second;
}
bool result = false;
if (!gSelectedConfig.empty())
{
std::stringstream strstr;
strstr << param;
if (strstr.str() == gSelectedConfig)
{
result = true;
}
}
else
{
const SystemInfo *systemInfo = GetTestSystemInfo();
bool result = false;
if (systemInfo)
{
result = IsConfigWhitelisted(*systemInfo, param);
@ -425,18 +438,18 @@ bool IsPlatformAvailable(const PlatformParameters &param)
{
result = IsConfigSupported(param);
}
paramAvailabilityCache[param] = result;
if (!result)
{
std::cout << "Skipping tests using configuration " << param
<< " because it is not available." << std::endl;
}
// Uncomment this to print available platforms.
// std::cout << "Platform: " << param << " (" << paramAvailabilityCache.size() << ")\n";
return result;
}
paramAvailabilityCache[param] = result;
if (!result)
{
std::cout << "Skipping tests using configuration " << param
<< " because it is not available." << std::endl;
}
// Uncomment this to print available platforms.
// std::cout << "Platform: " << param << " (" << paramAvailabilityCache.size() << ")\n";
return result;
}
} // namespace angle

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

@ -121,6 +121,9 @@ bool IsConfigSupported(const PlatformParameters &param);
// Returns shared test system information. Can be used globally in the tests.
SystemInfo *GetTestSystemInfo();
// Active config (e.g. ES2_Vulkan).
extern std::string gSelectedConfig;
} // namespace angle
#endif // ANGLE_TEST_INSTANTIATE_H_