From: John Richardson Date: Wed, 29 Mar 2017 13:19:56 +0000 (+0100) Subject: Add new EGL enum negative case to robustness tests X-Git-Tag: upstream/0.1.0~441^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=03db357e8f3929c696317afae63372611559aa5c;p=platform%2Fupstream%2FVK-GL-CTS.git Add new EGL enum negative case to robustness tests New test case for verifying EGL versions < 1.5 do not accept EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY enum in their attribute list when creating an EGL context. Test group: - dEQP-EGL.functional.robustness.negative_context New tests: - invalid_notification_strategy_enum Change-Id: I6027e880a2e3a97dfaa218c7b094ea727afcc996 --- diff --git a/android/cts/master/egl-master.txt b/android/cts/master/egl-master.txt index a997120..ae87b02 100644 --- a/android/cts/master/egl-master.txt +++ b/android/cts/master/egl-master.txt @@ -3635,3 +3635,4 @@ dEQP-EGL.functional.robustness.reset_context.fixed_function_pipeline.reset_statu dEQP-EGL.functional.robustness.reset_context.fixed_function_pipeline.reset_status.vertex_buffer_out_of_bounds dEQP-EGL.functional.robustness.negative_context.invalid_robust_context_creation dEQP-EGL.functional.robustness.negative_context.invalid_robust_shared_context_creation +dEQP-EGL.functional.robustness.negative_context.invalid_notification_strategy_enum diff --git a/modules/egl/teglRobustnessTests.cpp b/modules/egl/teglRobustnessTests.cpp index 269b866..ee9f0c9 100644 --- a/modules/egl/teglRobustnessTests.cpp +++ b/modules/egl/teglRobustnessTests.cpp @@ -172,6 +172,13 @@ void logAttribList (const EglTestContext& eglTestCtx, const EGLint* attribList) iter++; break; + case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR: + iter++; + attribListString << "EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, " + << eglResetNotificationStrategyToString(*iter) << ", "; + iter++; + break; + case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT: iter++; attribListString << "EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, "; @@ -1893,6 +1900,61 @@ public: } }; +class InvalidNotificationEnumCase : public RobustnessTestCase +{ +public: + InvalidNotificationEnumCase (EglTestContext& eglTestCtx, const char* name, const char* description) + : RobustnessTestCase (eglTestCtx, name, description) {} + + TestCase::IterateResult iterate (void) + { + TestLog& log = m_testCtx.getLog(); + const Library& egl = m_eglTestCtx.getLibrary(); + bool isOk = true; + + log << tcu::TestLog::Message + << "EGL_BAD_ATTRIBUTE is generated if EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR is used with EGL versions <= 1.4\n\n" + << tcu::TestLog::EndMessage; + + const EGLint attribList[] = + { + EGL_CONTEXT_CLIENT_VERSION, 3, + EGL_CONTEXT_MINOR_VERSION_KHR, 1, + EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, EGL_NO_RESET_NOTIFICATION, + EGL_NONE + }; + + if (eglu::getVersion(egl, m_eglDisplay) >= eglu::Version(1, 5)) + { + m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "Test requires EGL version to be under 1.5"); + return STOP; + } + + logAttribList(m_eglTestCtx, attribList); + EGLContext context = egl.createContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, attribList); + + const EGLenum error = egl.getError(); + if (error != EGL_BAD_ATTRIBUTE) + { + log << TestLog::Message + << "Test failed! eglCreateContext() returned with error [" << eglu::getErrorStr(error) << ", expected " << eglu::getErrorStr(EGL_BAD_ATTRIBUTE) << "]" + << TestLog::EndMessage; + + isOk = false; + } + + if (context != EGL_NO_CONTEXT) + egl.destroyContext(m_eglDisplay, context); + + if (isOk) + m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); + else + m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail"); + + return STOP; + } +}; + class SharedContextResetCase : public RobustnessTestCase { public: @@ -2407,8 +2469,9 @@ TestCaseGroup* createRobustnessTests (EglTestContext& eglTestCtx) // invalid context creation cases { - negativeContextTestGroup->addChild(new InvalidContextCase (eglTestCtx, "invalid_robust_context_creation", "Create a non-robust context but specify a reset notification strategy")); - negativeContextTestGroup->addChild(new InvalidShareContextCase (eglTestCtx, "invalid_robust_shared_context_creation", "Create a context share group with conflicting reset notification strategies")); + negativeContextTestGroup->addChild(new InvalidContextCase (eglTestCtx, "invalid_robust_context_creation", "Create a non-robust context but specify a reset notification strategy")); + negativeContextTestGroup->addChild(new InvalidShareContextCase (eglTestCtx, "invalid_robust_shared_context_creation", "Create a context share group with conflicting reset notification strategies")); + negativeContextTestGroup->addChild(new InvalidNotificationEnumCase (eglTestCtx, "invalid_notification_strategy_enum", "Create a robust context using EGL 1.5 only enum with EGL versions <= 1.4" )); } shadersTestGroup->addChild(infiniteLoopTestGroup);