Reintroduce error suppression in DebugTest expectMessage().
authorJarkko Pöyry <jpoyry@google.com>
Tue, 3 Mar 2015 22:06:23 +0000 (14:06 -0800)
committerJarkko Pöyry <jpoyry@google.com>
Tue, 3 Mar 2015 23:20:43 +0000 (15:20 -0800)
- Add error suppression back to expectMessage to prevent potentially
  dirty error state from affecting subsequent checks within a same
  test case. Error suppression was removed in b/18915042 when it was
  errorneously assumed that it was no longer needed after fixing
  b/18915339.
- Tolerate resource leakage in shader_source test.

Bug: 19589360
Bug: 18915042
Change-Id: I4e269f757c99173d4d7f0d5cc273699c0cb69628

modules/gles31/functional/es31fDebugTests.cpp
modules/gles31/functional/es31fNegativeShaderApiTests.cpp

index b96cd58..6a497ac 100644 (file)
@@ -171,7 +171,7 @@ void TestFunctionWrapper::call (DebugMessageTestContext& ctx) const
                DE_ASSERT(false);
 }
 
-void emitMessages(DebugMessageTestContext& ctx, GLenum source)
+void emitMessages (DebugMessageTestContext& ctx, GLenum source)
 {
        for (int typeNdx = 0; typeNdx < DE_LENGTH_OF_ARRAY(s_debugTypes); typeNdx++)
        {
@@ -667,6 +667,10 @@ void CallbackErrorCase::expectMessage (GLenum source, GLenum type)
 {
        verifyMessage(m_lastMessage, source, type);
        m_lastMessage = MessageData();
+
+       // Reset error so that code afterwards (such as glu::ShaderProgram) doesn't break because of
+       // lingering error state.
+       m_context.getRenderContext().getFunctions().getError();
 }
 
 void CallbackErrorCase::callback (GLenum source, GLenum type, GLuint id, GLenum severity, const string& message)
@@ -776,6 +780,10 @@ void LogErrorCase::expectMessage (GLenum source, GLenum type)
        log << TestLog::Message << "Driver says: \"" << lastMsg.message << "\"" << TestLog::EndMessage;
 
        verifyMessage(lastMsg, source, type);
+
+       // Reset error so that code afterwards (such as glu::ShaderProgram) doesn't break because of
+       // lingering error state.
+       m_context.getRenderContext().getFunctions().getError();
 }
 
 // Generate errors, verify that calling glGetError afterwards produces desired result
index 9ae4f14..e0d5a6e 100644 (file)
@@ -96,10 +96,12 @@ void create_shader (NegativeTestContext& ctx)
 
 void shader_source (NegativeTestContext& ctx)
 {
-       // \note Shader compilation must be supported.
+       // make notAShader not a shader id
+       const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
+       ctx.glDeleteShader(notAShader);
 
        ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
-       ctx.glShaderSource(1, 0, 0, 0);
+       ctx.glShaderSource(notAShader, 0, 0, 0);
        ctx.expectError(GL_INVALID_VALUE);
        ctx.endSection();