зеркало из https://github.com/AvaloniaUI/angle.git
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:
Родитель
051b0896a7
Коммит
97f0affbbd
|
@ -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 ¶m, OSWindow *osWindow
|
|||
}
|
||||
} // namespace
|
||||
|
||||
std::string gSelectedConfig;
|
||||
|
||||
SystemInfo *GetTestSystemInfo()
|
||||
{
|
||||
static SystemInfo *sSystemInfo = nullptr;
|
||||
|
@ -412,11 +414,22 @@ bool IsPlatformAvailable(const PlatformParameters ¶m)
|
|||
{
|
||||
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 ¶m)
|
|||
{
|
||||
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 ¶m);
|
|||
|
||||
// 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_
|
||||
|
|
Загрузка…
Ссылка в новой задаче