Don't require supported binary formats in negative tests.
authorHaixia Shi <hshi@google.com>
Thu, 25 Aug 2016 21:24:06 +0000 (14:24 -0700)
committerHaixia Shi <hshi@google.com>
Thu, 25 Aug 2016 21:45:34 +0000 (14:45 -0700)
Bug: 26906411
Change-Id: Ic1b50096695fbcd64d6af312d56f12c4381a5b7a

modules/gles31/functional/es31fNegativeShaderApiTests.cpp

index a35b94161cd3f51643b7ca1b12c01c8717e43e49..fe43f1087e081bf1d85d797eaea8dc506ab5d76c 100644 (file)
@@ -452,20 +452,24 @@ void program_binary (NegativeTestContext& ctx)
        ctx.glGetProgramiv              (srcProgram.getProgram(), GL_LINK_STATUS,                       &linkStatus);
        ctx.getLog() << TestLog::Message << "// GL_PROGRAM_BINARY_LENGTH = " << bufSize << TestLog::EndMessage;
        ctx.getLog() << TestLog::Message << "// GL_LINK_STATUS = " << linkStatus << TestLog::EndMessage;
-       TCU_CHECK(bufSize > 0);
-       binaryBuf.resize(bufSize);
-       ctx.glGetProgramBinary  (srcProgram.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryBuf[0]);
-       ctx.expectError         (GL_NO_ERROR);
 
-       ctx.beginSection("GL_INVALID_OPERATION is generated if program is not the name of an existing program object.");
-       ctx.glProgramBinary             (dummyShader, binaryFormat, &binaryBuf[0], binaryLength);
-       ctx.expectError         (GL_INVALID_OPERATION);
-       ctx.endSection();
+       TCU_CHECK(bufSize >= 0);
+       if (bufSize > 0)
+       {
+               binaryBuf.resize(bufSize);
+               ctx.glGetProgramBinary  (srcProgram.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryBuf[0]);
+               ctx.expectError                 (GL_NO_ERROR);
 
-       ctx.beginSection("GL_INVALID_ENUM is generated if binaryFormat is not a value recognized by the implementation.");
-       ctx.glProgramBinary             (dstProgram, -1, &binaryBuf[0], binaryLength);
-       ctx.expectError         (GL_INVALID_ENUM);
-       ctx.endSection();
+               ctx.beginSection("GL_INVALID_OPERATION is generated if program is not the name of an existing program object.");
+               ctx.glProgramBinary             (dummyShader, binaryFormat, &binaryBuf[0], binaryLength);
+               ctx.expectError                 (GL_INVALID_OPERATION);
+               ctx.endSection();
+
+               ctx.beginSection("GL_INVALID_ENUM is generated if binaryFormat is not a value recognized by the implementation.");
+               ctx.glProgramBinary             (dstProgram, -1, &binaryBuf[0], binaryLength);
+               ctx.expectError                 (GL_INVALID_ENUM);
+               ctx.endSection();
+       }
 
        ctx.glDeleteShader(dummyShader);
        ctx.glDeleteProgram(dstProgram);