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 @@
#include "test_utils/ANGLETest.h"
#include "libANGLE/Context.h"
#include "libANGLE/Program.h"
#include "test_utils/gl_raii.h"
using namespace angle;
......@@ -438,6 +436,12 @@ class GLSLTest : public ANGLETest
std::string mSimpleVSSource;
};
class GLSLTestNoValidation : public GLSLTest
{
public:
GLSLTestNoValidation() { setNoErrorEnabled(true); }
};
class GLSLTest_ES3 : public GLSLTest
{
void SetUp() override
......@@ -1538,7 +1542,7 @@ TEST_P(GLSLTest, StructSpecifiersUniforms)
// beginning with "gl_" are filtered out by our validation logic, we must
// bypass the validation to test the behaviour of the implementation.
// (note this test is still Impl-independent)
TEST_P(GLSLTest, DepthRangeUniforms)
TEST_P(GLSLTestNoValidation, DepthRangeUniforms)
{
const std::string fragmentShaderSource = SHADER_SOURCE
(
......@@ -1550,21 +1554,16 @@ TEST_P(GLSLTest, DepthRangeUniforms)
}
);
GLuint program = CompileProgram(mSimpleVSSource, fragmentShaderSource);
EXPECT_NE(0u, program);
ANGLE_GL_PROGRAM(program, mSimpleVSSource, fragmentShaderSource);
// dive into the ANGLE internals, so we can bypass validation.
gl::Context *context = reinterpret_cast<gl::Context *>(getEGLWindow()->getContext());
gl::Program *glProgram = context->getProgram(program);
GLint nearIndex = glProgram->getUniformLocation("gl_DepthRange.near");
// We need to bypass validation for this call.
GLint nearIndex = glGetUniformLocation(program.get(), "gl_DepthRange.near");
EXPECT_EQ(-1, nearIndex);
// Test drawing does not throw an exception.
drawQuad(program, "inputAttribute", 0.5f);
drawQuad(program.get(), "inputAttribute", 0.5f);
EXPECT_GL_NO_ERROR();
glDeleteProgram(program);
}
std::string GenerateSmallPowShader(double base, double exponent)
......@@ -2248,13 +2247,11 @@ TEST_P(GLSLTest_ES3, UnaryMinusOperatorSignedInt)
ANGLE_GL_PROGRAM(prog, vert, frag);
gl::Context *context = reinterpret_cast<gl::Context *>(getEGLWindow()->getContext());
gl::Program *glProgram = context->getProgram(prog.get());
GLint oneIndex = glProgram->getUniformLocation("ui_one");
GLint oneIndex = glGetUniformLocation(prog.get(), "ui_one");
ASSERT_NE(-1, oneIndex);
GLint twoIndex = glProgram->getUniformLocation("ui_two");
GLint twoIndex = glGetUniformLocation(prog.get(), "ui_two");
ASSERT_NE(-1, twoIndex);
GLint threeIndex = glProgram->getUniformLocation("ui_three");
GLint threeIndex = glGetUniformLocation(prog.get(), "ui_three");
ASSERT_NE(-1, threeIndex);
glUseProgram(prog.get());
glUniform1i(oneIndex, 1);
......@@ -2297,13 +2294,11 @@ TEST_P(GLSLTest_ES3, UnaryMinusOperatorUnsignedInt)
ANGLE_GL_PROGRAM(prog, vert, frag);
gl::Context *context = reinterpret_cast<gl::Context *>(getEGLWindow()->getContext());
gl::Program *glProgram = context->getProgram(prog.get());
GLint oneIndex = glProgram->getUniformLocation("ui_one");
GLint oneIndex = glGetUniformLocation(prog.get(), "ui_one");
ASSERT_NE(-1, oneIndex);
GLint twoIndex = glProgram->getUniformLocation("ui_two");
GLint twoIndex = glGetUniformLocation(prog.get(), "ui_two");
ASSERT_NE(-1, twoIndex);
GLint threeIndex = glProgram->getUniformLocation("ui_three");
GLint threeIndex = glGetUniformLocation(prog.get(), "ui_three");
ASSERT_NE(-1, threeIndex);
glUseProgram(prog.get());
glUniform1ui(oneIndex, 1u);
......
......@@ -919,7 +919,7 @@ TEST_P(MipmapTestES3, GenerateMipmapBaseLevel)
glBindTexture(GL_TEXTURE_2D, mTexture);
ASSERT(getWindowWidth() == getWindowHeight());
ASSERT_EQ(getWindowWidth(), getWindowHeight());
// Fill level 0 with blue
std::vector<GLColor> pixelsBlue(getWindowWidth() * getWindowHeight(), GLColor::blue);
......
......@@ -412,7 +412,7 @@ class ProgramBinariesAcrossPlatforms : public testing::TestWithParam<PlatformsWi
void destroyEGLWindow(EGLWindow **eglWindow)
{
ASSERT(*eglWindow != nullptr);
ASSERT_NE(nullptr, *eglWindow);
(*eglWindow)->destroyGL();
SafeDelete(*eglWindow);
*eglWindow = nullptr;
......
......@@ -29,7 +29,7 @@ GLColor SliceFormatColor(GLenum format, GLColor full)
case GL_RGBA:
return full;
default:
UNREACHABLE();
EXPECT_TRUE(false);
return GLColor::white;
}
}
......
......@@ -26,7 +26,7 @@ GLsizei TypeStride(GLenum attribType)
case GL_FLOAT:
return 4;
default:
UNREACHABLE();
EXPECT_TRUE(false);
return 0;
}
}
......
......@@ -78,7 +78,7 @@ std::ostream &operator<<(std::ostream& stream, const PlatformParameters &pp)
stream << "DEFAULT";
break;
default:
UNREACHABLE();
stream << "UNDEFINED";
break;
}
......
......@@ -52,8 +52,8 @@ bool IsPlatformAvailable(const PlatformParameters &param)
break;
default:
UNREACHABLE();
break;
std::cout << "Unknown test platform: " << param << std::endl;
return false;
}
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