From 1cbcb98a2528ea0d8ce34dc35513859c7ef957f3 Mon Sep 17 00:00:00 2001 From: Daniel Lam Date: Mon, 16 Apr 2012 22:21:02 -0700 Subject: Added an EGLTest for eglTerminate This tests if eglTerminate can succeed while objects are leaked. Currently the test fails because of a deadlock. Change-Id: Ibe26edfda28691284d0674e803e8d3114f3ce4c6 --- opengl/tests/EGLTest/Android.mk | 1 + opengl/tests/EGLTest/EGL_test.cpp | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/opengl/tests/EGLTest/Android.mk b/opengl/tests/EGLTest/Android.mk index d8e7012ab4..d820875667 100644 --- a/opengl/tests/EGLTest/Android.mk +++ b/opengl/tests/EGLTest/Android.mk @@ -15,6 +15,7 @@ LOCAL_SHARED_LIBRARIES := \ libcutils \ libstlport \ libutils \ + libgui \ LOCAL_STATIC_LIBRARIES := \ libgtest \ diff --git a/opengl/tests/EGLTest/EGL_test.cpp b/opengl/tests/EGLTest/EGL_test.cpp index 337ad33ebe..d511cae5e7 100644 --- a/opengl/tests/EGLTest/EGL_test.cpp +++ b/opengl/tests/EGLTest/EGL_test.cpp @@ -19,6 +19,9 @@ #include #include +#include +#include + namespace android { @@ -84,6 +87,35 @@ TEST_F(EGLTest, DISABLED_EGLConfigEightBitFirst) { EXPECT_GE(components[2], 8); } +TEST_F(EGLTest, EGLTerminateSucceedsWithRemainingObjects) { + EGLint numConfigs; + EGLConfig config; + EGLint attrs[] = { + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_NONE + }; + EXPECT_TRUE(eglChooseConfig(mEglDisplay, attrs, &config, 1, &numConfigs)); + + // Create a EGLSurface + sp bq = new BufferQueue(); + bq->consumerConnect(new DummyConsumer()); + sp mSTC = new SurfaceTextureClient(static_cast >( bq)); + sp mANW = mSTC; + + EGLSurface eglSurface = eglCreateWindowSurface(mEglDisplay, config, + mANW.get(), NULL); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + ASSERT_NE(EGL_NO_SURFACE, eglSurface) ; + + // do not destroy eglSurface + // eglTerminate is called in the tear down and should destroy it for us +} + TEST_F(EGLTest, EGLConfigRGBA8888First) { EGLint numConfigs; -- cgit v1.2.3-59-g8ed1b