tests: skip SwiftShader tests when building without SwiftShader

If we are building without SwiftShader, we shouldn't be forced to add
a gtest_filter of "-*SwiftShader*" in order to run the various tests.

Bug: angleproject:8291
Change-Id: Ic3513445d5d4bb402535a6f41bba818c0d15fd7a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4769826
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Auto-Submit: Steven Noonan <steven@uplinklabs.net>
This commit is contained in:
Steven Noonan
2023-08-10 10:28:01 -07:00
committed by Angle LUCI CQ
parent 237ff2b71b
commit 394699d3cc
2 changed files with 29 additions and 10 deletions

View File

@@ -96,6 +96,9 @@ config("angle_common_test_utils_config") {
if (angle_enable_gl_desktop_backend) {
defines += [ "ANGLE_ENABLE_GL_DESKTOP_BACKEND" ]
}
if (angle_enable_swiftshader) {
defines += [ "ANGLE_ENABLE_SWIFTSHADER" ]
}
}
template("angle_common_test_utils") {

View File

@@ -344,6 +344,15 @@ bool IsSwiftshaderDevice()
return HasSystemDeviceID(kVendorID_GOOGLE, kDeviceID_Swiftshader);
}
bool IsSwiftShaderSupported()
{
#if defined(ANGLE_ENABLE_SWIFTSHADER)
return true;
#else
return false;
#endif
}
bool IsNVIDIA()
{
#if defined(ANGLE_PLATFORM_ANDROID)
@@ -385,17 +394,24 @@ bool IsConfigAllowlisted(const SystemInfo &systemInfo, const PlatformParameters
return true;
}
// TODO: http://crbug.com/swiftshader/145
// Swiftshader does not currently have all the robustness features
// we need for ANGLE. In particular, it is unable to detect and recover
// from infinitely looping shaders. That bug is the tracker for fixing
// that and when resolved we can remove the following code.
// This test will disable tests marked with the config WithRobustness
// when run with the swiftshader Vulkan driver and on Android.
if ((param.isSwiftshader() || IsSwiftshaderDevice()) &&
param.eglParameters.robustness == EGL_TRUE)
if (param.isSwiftshader() || IsSwiftshaderDevice())
{
return false;
if (!IsSwiftShaderSupported())
{
return false;
}
// TODO: http://crbug.com/swiftshader/145
// Swiftshader does not currently have all the robustness features
// we need for ANGLE. In particular, it is unable to detect and recover
// from infinitely looping shaders. That bug is the tracker for fixing
// that and when resolved we can remove the following code.
// This test will disable tests marked with the config WithRobustness
// when run with the swiftshader Vulkan driver and on Android.
if (param.eglParameters.robustness == EGL_TRUE)
{
return false;
}
}
// Skip test configs that target the desktop OpenGL frontend when it's not enabled.