Catch BAD_MATCH from createWindowSurface
authorCourtney Goeltzenleuchter <courtneygo@google.com>
Tue, 12 Sep 2017 23:11:21 +0000 (17:11 -0600)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Tue, 7 Nov 2017 09:13:22 +0000 (04:13 -0500)
On some platforms, it's possible to fail createWindowSurface
for some attribute combinations. Catch that case and return
NotSupported rather than a test failure.
Test: adb -d shell am start \
        -n com.drawelements.deqp/android.app.NativeActivity \
        -e cmdLine '"deqp --deqp-case=dEQP-EGL.functional.wide_color.* \
        --deqp-log-filename=/sdcard/dEQP-Log.qpa"'
Bug: 65376495

(cherry picked from commit 7df6c12492c6baf9fdf9a3ea0b7f51e33722a4e8)
Change-Id: I6546cbdfc011c7d26cfa3cdad7cc6f0df1b67122

modules/egl/teglWideColorTests.cpp

index c512923..898cdda 100644 (file)
@@ -1136,7 +1136,18 @@ void WideColorSurfaceTest::executeTest (void)
                attribs.push_back(EGL_NONE);
                attribs.push_back(EGL_NONE);
 
-               const EGLSurface                                        surface                 = eglu::createWindowSurface(nativeDisplay, *window, m_eglDisplay, m_eglConfig, attribs.data());
+               EGLSurface      surface;
+               try
+               {
+                       surface = eglu::createWindowSurface(nativeDisplay, *window, m_eglDisplay, m_eglConfig, attribs.data());
+               }
+               catch (const eglu::Error& error)
+               {
+                       if (error.getError() == EGL_BAD_MATCH)
+                               TCU_THROW(NotSupportedError, "createWindowSurface is not supported for this config");
+
+                       throw;
+               }
                TCU_CHECK(surface != EGL_NO_SURFACE);
                EGLU_CHECK_MSG(egl, "eglCreateWindowSurface()");