Code refactoring for end2end tests.
This change:
1) uses the new style ANGLE_SKIP_TEST_IF to skip tests.
2) replaces compile-time definition for OSX to skip tests by run-time
function IsOSX() to skip tests, in order to align with ANGLE_SKIP_TEST_IF.
3) fixes a couple of typos.
BUG=angleproject:2005
Change-Id: I5af77d82257536b9eb79e26afa502f5b91ff6d31
Reviewed-on: https://chromium-review.googlesource.com/915861
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/tests/gl_tests/TextureTest.cpp b/src/tests/gl_tests/TextureTest.cpp
index 7e8a954..01f58e2 100644
--- a/src/tests/gl_tests/TextureTest.cpp
+++ b/src/tests/gl_tests/TextureTest.cpp
@@ -178,60 +178,26 @@
if (getClientMajorVersion() < 3)
{
- if (!extensionEnabled("GL_EXT_texture_storage"))
- {
- std::cout << "Test skipped due to missing GL_EXT_texture_storage." << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_EXT_texture_storage") ||
+ !extensionEnabled("GL_OES_texture_float"));
- if (!extensionEnabled("GL_OES_texture_float"))
- {
- std::cout << "Test skipped due to missing GL_OES_texture_float." << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF((sourceImageChannels < 3 || destImageChannels < 3) &&
+ !extensionEnabled("GL_EXT_texture_rg"));
- if ((sourceImageChannels < 3 || destImageChannels < 3) && !extensionEnabled("GL_EXT_texture_rg"))
- {
- std::cout << "Test skipped due to missing GL_EXT_texture_rg." << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(destImageChannels == 3 &&
+ !extensionEnabled("GL_CHROMIUM_color_buffer_float_rgb"));
- if (destImageChannels == 3 && !extensionEnabled("GL_CHROMIUM_color_buffer_float_rgb"))
- {
- std::cout << "Test skipped due to missing GL_CHROMIUM_color_buffer_float_rgb."
- << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(destImageChannels == 4 &&
+ !extensionEnabled("GL_CHROMIUM_color_buffer_float_rgba"));
- if (destImageChannels == 4 && !extensionEnabled("GL_CHROMIUM_color_buffer_float_rgba"))
- {
- std::cout << "Test skipped due to missing GL_CHROMIUM_color_buffer_float_rgb."
- << std::endl;
- return;
- }
-
- if (destImageChannels <= 2)
- {
- std::cout << "Test skipped because no extensions grant renderability to 1 and 2 "
- "channel floating point textures."
- << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(destImageChannels <= 2);
}
else
{
- if (!extensionEnabled("GL_color_buffer_float"))
- {
- std::cout << "Test skipped due to missing GL_color_buffer_float." << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_color_buffer_float"));
- if (destImageChannels == 3 && !extensionEnabled("GL_CHROMIUM_color_buffer_float_rgb"))
- {
- std::cout << "Test skipped due to missing GL_CHROMIUM_color_buffer_float_rgb."
- << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(destImageChannels == 3 &&
+ !extensionEnabled("GL_CHROMIUM_color_buffer_float_rgb"));
}
GLfloat sourceImageData[4][16] =
@@ -1434,12 +1400,7 @@
// Test that glTexSubImage2D works properly when glTexStorage2DEXT has initialized the image with a default color.
TEST_P(Texture2DTest, TexStorage)
{
- if (getClientMajorVersion() < 3 && !extensionEnabled("GL_EXT_texture_storage"))
- {
- std::cout << "Test skipped because ES3 or GL_EXT_texture_storage not available."
- << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(getClientMajorVersion() < 3 && !extensionEnabled("GL_EXT_texture_storage"));
int width = getWindowWidth();
int height = getWindowHeight();
@@ -1570,19 +1531,11 @@
TEST_P(Texture2DTest, CopySubImageFloat_RGB_RGB)
{
- if (IsIntel() && IsLinux())
- {
- // TODO(cwallez): Fix on Linux Intel drivers (http://anglebug.com/1346)
- std::cout << "Test disabled on Linux Intel OpenGL." << std::endl;
- return;
- }
+ // TODO(cwallez): Fix on Linux Intel drivers (http://anglebug.com/1346)
+ ANGLE_SKIP_TEST_IF(IsIntel() && IsLinux());
- // TODO (bug 1284): Investigate RGBA32f D3D SDK Layers messages on D3D11_FL9_3
- if (IsD3D11_FL93())
- {
- std::cout << "Test skipped on Feature Level 9_3." << std::endl;
- return;
- }
+ // Ignore SDK layers messages on D3D11 FL 9.3 (http://anglebug.com/1284)
+ ANGLE_SKIP_TEST_IF(IsD3D11_FL93());
testFloatCopySubImage(3, 3);
}
@@ -1599,24 +1552,16 @@
TEST_P(Texture2DTest, CopySubImageFloat_RGBA_RGB)
{
- // TODO (bug 1284): Investigate RGBA32f D3D SDK Layers messages on D3D11_FL9_3
- if (IsD3D11_FL93())
- {
- std::cout << "Test skipped on Feature Level 9_3." << std::endl;
- return;
- }
+ // Ignore SDK layers messages on D3D11 FL 9.3 (http://anglebug.com/1284)
+ ANGLE_SKIP_TEST_IF(IsD3D11_FL93());
testFloatCopySubImage(4, 3);
}
TEST_P(Texture2DTest, CopySubImageFloat_RGBA_RGBA)
{
- // TODO (bug 1284): Investigate RGBA32f D3D SDK Layers messages on D3D11_FL9_3
- if (IsD3D11_FL93())
- {
- std::cout << "Test skipped on Feature Level 9_3." << std::endl;
- return;
- }
+ // Ignore SDK layers messages on D3D11 FL 9.3 (http://anglebug.com/1284)
+ ANGLE_SKIP_TEST_IF(IsD3D11_FL93());
testFloatCopySubImage(4, 4);
}
@@ -1759,12 +1704,9 @@
// have images defined.
TEST_P(Texture2DTestES3, DrawWithLevelsOutsideRangeUndefined)
{
- if (IsAMD() && getPlatformRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE)
- {
- // Observed crashing on AMD. Oddly the crash only happens with 2D textures, not 3D or array.
- std::cout << "Test skipped on AMD OpenGL." << std::endl;
- return;
- }
+ // Observed crashing on AMD. Oddly the crash only happens with 2D textures, not 3D or array.
+ ANGLE_SKIP_TEST_IF(IsAMD() && IsOpenGL());
+
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, mTexture2D);
std::vector<GLColor> texDataGreen(2u * 2u, GLColor::green);
@@ -1785,12 +1727,9 @@
// Test that drawing works correctly when level 0 is undefined and base level is 1.
TEST_P(Texture2DTestES3, DrawWithLevelZeroUndefined)
{
- if (IsAMD() && getPlatformRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE)
- {
- // Observed crashing on AMD. Oddly the crash only happens with 2D textures, not 3D or array.
- std::cout << "Test skipped on AMD OpenGL." << std::endl;
- return;
- }
+ // Observed crashing on AMD. Oddly the crash only happens with 2D textures, not 3D or array.
+ ANGLE_SKIP_TEST_IF(IsAMD() && IsOpenGL());
+
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, mTexture2D);
std::vector<GLColor> texDataGreen(2u * 2u, GLColor::green);
@@ -1983,14 +1922,9 @@
ANGLE_SKIP_TEST_IF(IsIntel() && IsWindows() && IsOpenGL());
- if (IsNVIDIA() && (getPlatformRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE ||
- getPlatformRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE))
- {
- // NVIDIA was observed drawing color 0,0,0,0 instead of the texture color after the base
- // level was changed.
- std::cout << "Test partially skipped on NVIDIA OpenGL." << std::endl;
- return;
- }
+ // NVIDIA was observed drawing color 0,0,0,0 instead of the texture color after the base
+ // level was changed.
+ ANGLE_SKIP_TEST_IF(IsNVIDIA() && (IsOpenGL() || IsOpenGLES()));
// Switch the level that is being used to the cyan level 2.
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BASE_LEVEL, 2);
@@ -2177,19 +2111,13 @@
// Test that changing base level works when it affects the format of the texture.
TEST_P(Texture2DTestES3, TextureFormatChangesWithBaseLevel)
{
- if (IsNVIDIA() && IsOpenGL())
- {
- // Observed rendering corruption on NVIDIA OpenGL.
- std::cout << "Test skipped on NVIDIA OpenGL." << std::endl;
- return;
- }
+ // Observed rendering corruption on NVIDIA OpenGL.
+ ANGLE_SKIP_TEST_IF(IsNVIDIA() && IsOpenGL());
+
ANGLE_SKIP_TEST_IF(IsIntel() && IsWindows() && IsDesktopOpenGL());
- if (IsAMD() && IsDesktopOpenGL())
- {
- // Observed incorrect rendering on AMD OpenGL.
- std::cout << "Test skipped on AMD OpenGL." << std::endl;
- return;
- }
+
+ // Observed incorrect rendering on AMD OpenGL.
+ ANGLE_SKIP_TEST_IF(IsAMD() && IsDesktopOpenGL());
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, mTexture2D);
@@ -2395,11 +2323,8 @@
// Calling textureSize() on the samplers hits the D3D sampler metadata workaround.
TEST_P(TextureSizeTextureArrayTest, BaseLevelVariesInTextureArray)
{
- if (IsAMD() && IsD3D11())
- {
- std::cout << "Test skipped on AMD D3D." << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(IsAMD() && IsD3D11());
+
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, mTexture2DA);
GLsizei size = 64;
@@ -2489,17 +2414,10 @@
{
if (extensionEnabled("GL_OES_texture_half_float"))
{
- if (IsNVIDIA() && IsOpenGLES())
- {
- std::cout << "Test skipped on NVIDIA" << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(IsNVIDIA() && IsOpenGLES());
+
// TODO(ynovikov): re-enable once root cause of http://anglebug.com/1420 is fixed
- if (IsAndroid() && IsAdreno() && IsOpenGLES())
- {
- std::cout << "Test skipped on Adreno OpenGLES on Android." << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(IsAndroid() && IsAdreno() && IsOpenGLES());
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, mTexture2D);
@@ -2655,12 +2573,8 @@
// ES 3.0.4 table 3.24
TEST_P(Texture2DTestES3, TextureCOMPRESSEDRGB8ETC2ImplicitAlpha1)
{
- if (IsOSX() && IsIntel() && IsOpenGL())
- {
- // Seems to fail on OSX 10.12 Intel.
- std::cout << "Test skipped on OSX Intel." << std::endl;
- return;
- }
+ // Seems to fail on OSX 10.12 Intel.
+ ANGLE_SKIP_TEST_IF(IsOSX() && IsIntel() && IsOpenGL());
// http://anglebug.com/2190
ANGLE_SKIP_TEST_IF(IsOSX() && IsNVIDIA() && IsDesktopOpenGL());
@@ -2679,12 +2593,8 @@
// ES 3.0.4 table 3.24
TEST_P(Texture2DTestES3, TextureCOMPRESSEDSRGB8ETC2ImplicitAlpha1)
{
- if (IsOSX() && IsIntel() && IsOpenGL())
- {
- // Seems to fail on OSX 10.12 Intel.
- std::cout << "Test skipped on OSX Intel." << std::endl;
- return;
- }
+ // Seems to fail on OSX 10.12 Intel.
+ ANGLE_SKIP_TEST_IF(IsOSX() && IsIntel() && IsOpenGL());
// http://anglebug.com/2190
ANGLE_SKIP_TEST_IF(IsOSX() && IsNVIDIA() && IsDesktopOpenGL());
@@ -2709,11 +2619,7 @@
TEST_P(SamplerInStructAsFunctionParameterTest, SamplerInStructAsFunctionParameter)
{
// TODO(ynovikov): re-enable once root cause of http://anglebug.com/1427 is fixed
- if (IsAndroid() && IsAdreno() && IsOpenGLES())
- {
- std::cout << "Test skipped on Adreno OpenGLES on Android." << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(IsAndroid() && IsAdreno() && IsOpenGLES());
runSamplerInStructTest();
}
@@ -2723,11 +2629,8 @@
TEST_P(SamplerInStructArrayAsFunctionParameterTest, SamplerInStructArrayAsFunctionParameter)
{
// TODO(ynovikov): re-enable once root cause of http://anglebug.com/1427 is fixed
- if (IsAndroid() && IsAdreno() && IsOpenGLES())
- {
- std::cout << "Test skipped on Adreno OpenGLES on Android." << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(IsAndroid() && IsAdreno() && IsOpenGLES());
+
runSamplerInStructTest();
}
@@ -2736,11 +2639,8 @@
TEST_P(SamplerInNestedStructAsFunctionParameterTest, SamplerInNestedStructAsFunctionParameter)
{
// TODO(ynovikov): re-enable once root cause of http://anglebug.com/1427 is fixed
- if (IsAndroid() && IsAdreno() && IsOpenGLES())
- {
- std::cout << "Test skipped on Adreno OpenGLES on Android." << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(IsAndroid() && IsAdreno() && IsOpenGLES());
+
runSamplerInStructTest();
}
@@ -3196,11 +3096,7 @@
// Test texture formats enabled by the GL_EXT_texture_norm16 extension.
TEST_P(Texture2DNorm16TestES3, TextureNorm16Test)
{
- if (!extensionEnabled("GL_EXT_texture_norm16"))
- {
- std::cout << "Test skipped due to missing GL_EXT_texture_norm16." << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_EXT_texture_norm16"));
testNorm16Texture(GL_R16_EXT, GL_RED, GL_UNSIGNED_SHORT);
testNorm16Texture(GL_RG16_EXT, GL_RG, GL_UNSIGNED_SHORT);
@@ -3223,11 +3119,7 @@
ANGLE_SKIP_TEST_IF(IsIntel() && IsWindows() && IsDesktopOpenGL());
// TODO(ynovikov): re-enable once root cause of http://anglebug.com/1429 is fixed
- if (IsAndroid() && IsAdreno() && IsOpenGLES())
- {
- std::cout << "Test skipped on Adreno OpenGLES on Android." << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(IsAndroid() && IsAdreno() && IsOpenGLES());
glBindTexture(GL_TEXTURE_2D, mTexture2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -3291,17 +3183,10 @@
// Test that unpacking rows that overlap in a pixel unpack buffer works as expected.
TEST_P(Texture2DTestES3, UnpackOverlappingRowsFromUnpackBuffer)
{
- if (IsD3D11())
- {
- std::cout << "Test skipped on D3D." << std::endl;
- return;
- }
- if (IsOSX() && IsAMD())
- {
- // Incorrect rendering results seen on OSX AMD.
- std::cout << "Test skipped on OSX AMD." << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(IsD3D11());
+
+ // Incorrect rendering results seen on OSX AMD.
+ ANGLE_SKIP_TEST_IF(IsOSX() && IsAMD());
const GLuint width = 8u;
const GLuint height = 8u;
@@ -3361,11 +3246,7 @@
// TODO(cwallez) this is failing on Intel Win7 OpenGL.
// TODO(zmo) this is faling on Win Intel HD 530 Debug.
// http://anglebugs.com/1706
- if (IsIntel() && IsWindows())
- {
- std::cout << "Test skipped on Win Intel." << std::endl;
- return;
- }
+ ANGLE_SKIP_TEST_IF(IsIntel() && IsWindows());
const int size = getWindowWidth();