Commit e1faacb1 by Jamie Madill Committed by Commit Bot

Don't use logging macros in end2end_tests.

Macros like ASSERT and UNREACHABLE call gl::trace, which at some point we might want to use to call the angle Platform logging code. Standalone tests won't easily have access to the platform, so for now just log errors in other ways. This also corrects some logic in GLSLTest which was calling internal methods in libANGLE when it didn't have to. BUG=angleproject:1660 Change-Id: Idecbd97f2de7916b35bd78f5b7cd02b156ea100d Reviewed-on: https://chromium-review.googlesource.com/419134 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent bd0c08e2
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
#include "test_utils/ANGLETest.h" #include "test_utils/ANGLETest.h"
#include "libANGLE/Context.h"
#include "libANGLE/Program.h"
#include "test_utils/gl_raii.h" #include "test_utils/gl_raii.h"
using namespace angle; using namespace angle;
...@@ -438,6 +436,12 @@ class GLSLTest : public ANGLETest ...@@ -438,6 +436,12 @@ class GLSLTest : public ANGLETest
std::string mSimpleVSSource; std::string mSimpleVSSource;
}; };
class GLSLTestNoValidation : public GLSLTest
{
public:
GLSLTestNoValidation() { setNoErrorEnabled(true); }
};
class GLSLTest_ES3 : public GLSLTest class GLSLTest_ES3 : public GLSLTest
{ {
void SetUp() override void SetUp() override
...@@ -1538,7 +1542,7 @@ TEST_P(GLSLTest, StructSpecifiersUniforms) ...@@ -1538,7 +1542,7 @@ TEST_P(GLSLTest, StructSpecifiersUniforms)
// beginning with "gl_" are filtered out by our validation logic, we must // beginning with "gl_" are filtered out by our validation logic, we must
// bypass the validation to test the behaviour of the implementation. // bypass the validation to test the behaviour of the implementation.
// (note this test is still Impl-independent) // (note this test is still Impl-independent)
TEST_P(GLSLTest, DepthRangeUniforms) TEST_P(GLSLTestNoValidation, DepthRangeUniforms)
{ {
const std::string fragmentShaderSource = SHADER_SOURCE const std::string fragmentShaderSource = SHADER_SOURCE
( (
...@@ -1550,21 +1554,16 @@ TEST_P(GLSLTest, DepthRangeUniforms) ...@@ -1550,21 +1554,16 @@ TEST_P(GLSLTest, DepthRangeUniforms)
} }
); );
GLuint program = CompileProgram(mSimpleVSSource, fragmentShaderSource); ANGLE_GL_PROGRAM(program, mSimpleVSSource, fragmentShaderSource);
EXPECT_NE(0u, program);
// dive into the ANGLE internals, so we can bypass validation. // We need to bypass validation for this call.
gl::Context *context = reinterpret_cast<gl::Context *>(getEGLWindow()->getContext()); GLint nearIndex = glGetUniformLocation(program.get(), "gl_DepthRange.near");
gl::Program *glProgram = context->getProgram(program);
GLint nearIndex = glProgram->getUniformLocation("gl_DepthRange.near");
EXPECT_EQ(-1, nearIndex); EXPECT_EQ(-1, nearIndex);
// Test drawing does not throw an exception. // Test drawing does not throw an exception.
drawQuad(program, "inputAttribute", 0.5f); drawQuad(program.get(), "inputAttribute", 0.5f);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
glDeleteProgram(program);
} }
std::string GenerateSmallPowShader(double base, double exponent) std::string GenerateSmallPowShader(double base, double exponent)
...@@ -2248,13 +2247,11 @@ TEST_P(GLSLTest_ES3, UnaryMinusOperatorSignedInt) ...@@ -2248,13 +2247,11 @@ TEST_P(GLSLTest_ES3, UnaryMinusOperatorSignedInt)
ANGLE_GL_PROGRAM(prog, vert, frag); ANGLE_GL_PROGRAM(prog, vert, frag);
gl::Context *context = reinterpret_cast<gl::Context *>(getEGLWindow()->getContext()); GLint oneIndex = glGetUniformLocation(prog.get(), "ui_one");
gl::Program *glProgram = context->getProgram(prog.get());
GLint oneIndex = glProgram->getUniformLocation("ui_one");
ASSERT_NE(-1, oneIndex); ASSERT_NE(-1, oneIndex);
GLint twoIndex = glProgram->getUniformLocation("ui_two"); GLint twoIndex = glGetUniformLocation(prog.get(), "ui_two");
ASSERT_NE(-1, twoIndex); ASSERT_NE(-1, twoIndex);
GLint threeIndex = glProgram->getUniformLocation("ui_three"); GLint threeIndex = glGetUniformLocation(prog.get(), "ui_three");
ASSERT_NE(-1, threeIndex); ASSERT_NE(-1, threeIndex);
glUseProgram(prog.get()); glUseProgram(prog.get());
glUniform1i(oneIndex, 1); glUniform1i(oneIndex, 1);
...@@ -2297,13 +2294,11 @@ TEST_P(GLSLTest_ES3, UnaryMinusOperatorUnsignedInt) ...@@ -2297,13 +2294,11 @@ TEST_P(GLSLTest_ES3, UnaryMinusOperatorUnsignedInt)
ANGLE_GL_PROGRAM(prog, vert, frag); ANGLE_GL_PROGRAM(prog, vert, frag);
gl::Context *context = reinterpret_cast<gl::Context *>(getEGLWindow()->getContext()); GLint oneIndex = glGetUniformLocation(prog.get(), "ui_one");
gl::Program *glProgram = context->getProgram(prog.get());
GLint oneIndex = glProgram->getUniformLocation("ui_one");
ASSERT_NE(-1, oneIndex); ASSERT_NE(-1, oneIndex);
GLint twoIndex = glProgram->getUniformLocation("ui_two"); GLint twoIndex = glGetUniformLocation(prog.get(), "ui_two");
ASSERT_NE(-1, twoIndex); ASSERT_NE(-1, twoIndex);
GLint threeIndex = glProgram->getUniformLocation("ui_three"); GLint threeIndex = glGetUniformLocation(prog.get(), "ui_three");
ASSERT_NE(-1, threeIndex); ASSERT_NE(-1, threeIndex);
glUseProgram(prog.get()); glUseProgram(prog.get());
glUniform1ui(oneIndex, 1u); glUniform1ui(oneIndex, 1u);
......
...@@ -919,7 +919,7 @@ TEST_P(MipmapTestES3, GenerateMipmapBaseLevel) ...@@ -919,7 +919,7 @@ TEST_P(MipmapTestES3, GenerateMipmapBaseLevel)
glBindTexture(GL_TEXTURE_2D, mTexture); glBindTexture(GL_TEXTURE_2D, mTexture);
ASSERT(getWindowWidth() == getWindowHeight()); ASSERT_EQ(getWindowWidth(), getWindowHeight());
// Fill level 0 with blue // Fill level 0 with blue
std::vector<GLColor> pixelsBlue(getWindowWidth() * getWindowHeight(), GLColor::blue); std::vector<GLColor> pixelsBlue(getWindowWidth() * getWindowHeight(), GLColor::blue);
......
...@@ -412,7 +412,7 @@ class ProgramBinariesAcrossPlatforms : public testing::TestWithParam<PlatformsWi ...@@ -412,7 +412,7 @@ class ProgramBinariesAcrossPlatforms : public testing::TestWithParam<PlatformsWi
void destroyEGLWindow(EGLWindow **eglWindow) void destroyEGLWindow(EGLWindow **eglWindow)
{ {
ASSERT(*eglWindow != nullptr); ASSERT_NE(nullptr, *eglWindow);
(*eglWindow)->destroyGL(); (*eglWindow)->destroyGL();
SafeDelete(*eglWindow); SafeDelete(*eglWindow);
*eglWindow = nullptr; *eglWindow = nullptr;
......
...@@ -29,7 +29,7 @@ GLColor SliceFormatColor(GLenum format, GLColor full) ...@@ -29,7 +29,7 @@ GLColor SliceFormatColor(GLenum format, GLColor full)
case GL_RGBA: case GL_RGBA:
return full; return full;
default: default:
UNREACHABLE(); EXPECT_TRUE(false);
return GLColor::white; return GLColor::white;
} }
} }
......
...@@ -26,7 +26,7 @@ GLsizei TypeStride(GLenum attribType) ...@@ -26,7 +26,7 @@ GLsizei TypeStride(GLenum attribType)
case GL_FLOAT: case GL_FLOAT:
return 4; return 4;
default: default:
UNREACHABLE(); EXPECT_TRUE(false);
return 0; return 0;
} }
} }
......
...@@ -78,8 +78,8 @@ std::ostream &operator<<(std::ostream& stream, const PlatformParameters &pp) ...@@ -78,8 +78,8 @@ std::ostream &operator<<(std::ostream& stream, const PlatformParameters &pp)
stream << "DEFAULT"; stream << "DEFAULT";
break; break;
default: default:
UNREACHABLE(); stream << "UNDEFINED";
break; break;
} }
if (pp.eglParameters.majorVersion != EGL_DONT_CARE) if (pp.eglParameters.majorVersion != EGL_DONT_CARE)
......
...@@ -52,8 +52,8 @@ bool IsPlatformAvailable(const PlatformParameters &param) ...@@ -52,8 +52,8 @@ bool IsPlatformAvailable(const PlatformParameters &param)
break; break;
default: default:
UNREACHABLE(); std::cout << "Unknown test platform: " << param << std::endl;
break; return false;
} }
static std::map<PlatformParameters, bool> paramAvailabilityCache; static std::map<PlatformParameters, bool> paramAvailabilityCache;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment