Commit 49ad51fb by Jamie Madill Committed by Commit Bot

ANGLETest: Skip test setup/teardown on major error.

If something goes wrong in ANGLETestSetup, we can skip the test- specific setup and teardown code to prevent further errors and crashes. This is necessary for the new test expectation skips. Bug: angleproject:5951 Change-Id: Ica7b9fed18cec20e7d0e340c39dbbb44f1f8958e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2896173Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent f9ca452c
...@@ -577,6 +577,7 @@ void ANGLETestBase::ANGLETestSetUp() ...@@ -577,6 +577,7 @@ void ANGLETestBase::ANGLETestSetUp()
if (mCurrentParams->noFixture) if (mCurrentParams->noFixture)
{ {
LoadEntryPointsWithUtilLoader(mCurrentParams->driver); LoadEntryPointsWithUtilLoader(mCurrentParams->driver);
mIsSetUp = true;
return; return;
} }
...@@ -593,6 +594,7 @@ void ANGLETestBase::ANGLETestSetUp() ...@@ -593,6 +594,7 @@ void ANGLETestBase::ANGLETestSetUp()
if (!mFixture->osWindow->valid()) if (!mFixture->osWindow->valid())
{ {
mIsSetUp = true;
return; return;
} }
...@@ -673,6 +675,8 @@ void ANGLETestBase::ANGLETestSetUp() ...@@ -673,6 +675,8 @@ void ANGLETestBase::ANGLETestSetUp()
// taking OpenGL traces can guess the size of the default framebuffer and show it // taking OpenGL traces can guess the size of the default framebuffer and show it
// in their UIs // in their UIs
glViewport(0, 0, mWidth, mHeight); glViewport(0, 0, mWidth, mHeight);
mIsSetUp = true;
} }
void ANGLETestBase::ANGLETestTearDown() void ANGLETestBase::ANGLETestTearDown()
......
...@@ -520,6 +520,8 @@ class ANGLETestBase ...@@ -520,6 +520,8 @@ class ANGLETestBase
return mCurrentParams->getAllocateNonZeroMemoryFeature() == EGL_TRUE; return mCurrentParams->getAllocateNonZeroMemoryFeature() == EGL_TRUE;
} }
bool mIsSetUp = false;
private: private:
void checkD3D11SDKLayersMessages(); void checkD3D11SDKLayersMessages();
...@@ -604,12 +606,18 @@ class ANGLETestWithParam : public ANGLETestBase, public ::testing::TestWithParam ...@@ -604,12 +606,18 @@ class ANGLETestWithParam : public ANGLETestBase, public ::testing::TestWithParam
void SetUp() final void SetUp() final
{ {
ANGLETestBase::ANGLETestSetUp(); ANGLETestBase::ANGLETestSetUp();
testSetUp(); if (mIsSetUp)
{
testSetUp();
}
} }
void TearDown() final void TearDown() final
{ {
testTearDown(); if (mIsSetUp)
{
testTearDown();
}
ANGLETestBase::ANGLETestTearDown(); ANGLETestBase::ANGLETestTearDown();
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment