Commit fdb7874d by Shahbaz Youssefi Committed by Commit Bot

Gracefully fail end2end tests if no window support

EGL_WINDOW_BIT is now specifically requested for tests that open a window (those that aren't WithNoFixture). This makes sure pbuffer-only configs are not selected for the window. Additionally, a few WithNoFixture tests are made more robust in the presence of no-window configs. In the context of crbug.com/1034840, this means that a subset of end2end tests would be able to run in a remote desktop environment. Tested on Linux/X11 by turning a subset of configs PBUFFER-only. Bug: chromium:1034840 Change-Id: I09fd149d43d3b865856fe6b9491c5f333f4a2efc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2378922Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarback sept 10 - Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent e3db3d20
...@@ -62,14 +62,31 @@ class EGLRobustnessTest : public ANGLETest ...@@ -62,14 +62,31 @@ class EGLRobustnessTest : public ANGLETest
ASSERT_TRUE(eglGetConfigs(mDisplay, nullptr, 0, &nConfigs) == EGL_TRUE); ASSERT_TRUE(eglGetConfigs(mDisplay, nullptr, 0, &nConfigs) == EGL_TRUE);
ASSERT_LE(1, nConfigs); ASSERT_LE(1, nConfigs);
std::vector<EGLConfig> allConfigs(nConfigs);
int nReturnedConfigs = 0; int nReturnedConfigs = 0;
ASSERT_TRUE(eglGetConfigs(mDisplay, &mConfig, 1, &nReturnedConfigs) == EGL_TRUE); ASSERT_TRUE(eglGetConfigs(mDisplay, allConfigs.data(), nConfigs, &nReturnedConfigs) ==
ASSERT_EQ(1, nReturnedConfigs); EGL_TRUE);
ASSERT_EQ(nConfigs, nReturnedConfigs);
mWindow = eglCreateWindowSurface(mDisplay, mConfig, mOSWindow->getNativeWindow(), nullptr); for (const EGLConfig &config : allConfigs)
ASSERT_EGL_SUCCESS(); {
EGLint surfaceType;
eglGetConfigAttrib(mDisplay, config, EGL_SURFACE_TYPE, &surfaceType);
if ((surfaceType & EGL_WINDOW_BIT) != 0)
{
mConfig = config;
mInitialized = true; mInitialized = true;
break;
}
}
if (mInitialized)
{
mWindow =
eglCreateWindowSurface(mDisplay, mConfig, mOSWindow->getNativeWindow(), nullptr);
ASSERT_EGL_SUCCESS();
}
} }
void testTearDown() override void testTearDown() override
......
...@@ -58,10 +58,25 @@ class MultisampleTest : public ANGLETestWithParam<MultisampleTestParams> ...@@ -58,10 +58,25 @@ class MultisampleTest : public ANGLETestWithParam<MultisampleTestParams>
ANGLE_SKIP_TEST_IF(IsNexus5X() || IsNexus6P()); ANGLE_SKIP_TEST_IF(IsNexus5X() || IsNexus6P());
// Find a config that uses RGBA8 and allows 4x multisampling. // Find a config that uses RGBA8 and allows 4x multisampling.
const EGLint configAttributes[] = { const EGLint configAttributes[] = {EGL_SURFACE_TYPE,
EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_WINDOW_BIT,
EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 24, EGL_STENCIL_SIZE, 8, EGL_RED_SIZE,
EGL_SAMPLE_BUFFERS, 1, EGL_SAMPLES, 4, EGL_NONE}; 8,
EGL_GREEN_SIZE,
8,
EGL_BLUE_SIZE,
8,
EGL_ALPHA_SIZE,
8,
EGL_DEPTH_SIZE,
24,
EGL_STENCIL_SIZE,
8,
EGL_SAMPLE_BUFFERS,
1,
EGL_SAMPLES,
4,
EGL_NONE};
EGLint configCount; EGLint configCount;
EGLConfig multisampledConfig; EGLConfig multisampledConfig;
......
...@@ -453,7 +453,7 @@ void ANGLETestBase::initOSWindow() ...@@ -453,7 +453,7 @@ void ANGLETestBase::initOSWindow()
mFixture->osWindow->disableErrorMessageDialog(); mFixture->osWindow->disableErrorMessageDialog();
if (!mFixture->osWindow->initialize(windowName.c_str(), 128, 128)) if (!mFixture->osWindow->initialize(windowName.c_str(), 128, 128))
{ {
std::cerr << "Failed to initialize OS Window."; std::cerr << "Failed to initialize OS Window.\n";
} }
if (IsAndroid()) if (IsAndroid())
...@@ -463,6 +463,11 @@ void ANGLETestBase::initOSWindow() ...@@ -463,6 +463,11 @@ void ANGLETestBase::initOSWindow()
} }
} }
if (!mFixture->osWindow->valid())
{
return;
}
// On Linux we must keep the test windows visible. On Windows it doesn't seem to need it. // On Linux we must keep the test windows visible. On Windows it doesn't seem to need it.
setWindowVisible(getOSWindow(), !IsWindows()); setWindowVisible(getOSWindow(), !IsWindows());
...@@ -556,6 +561,16 @@ void ANGLETestBase::ANGLETestSetUp() ...@@ -556,6 +561,16 @@ void ANGLETestBase::ANGLETestSetUp()
mLastLoadedDriver = mCurrentParams->driver; mLastLoadedDriver = mCurrentParams->driver;
} }
if (gEnableANGLEPerTestCaptureLabel)
{
SetupEnvironmentVarsForCaptureReplay();
}
if (!mFixture->osWindow->valid())
{
return;
}
// Resize the window before creating the context so that the first make current // Resize the window before creating the context so that the first make current
// sets the viewport and scissor box to the right size. // sets the viewport and scissor box to the right size.
bool needSwap = false; bool needSwap = false;
...@@ -567,10 +582,6 @@ void ANGLETestBase::ANGLETestSetUp() ...@@ -567,10 +582,6 @@ void ANGLETestBase::ANGLETestSetUp()
} }
needSwap = true; needSwap = true;
} }
if (gEnableANGLEPerTestCaptureLabel)
{
SetupEnvironmentVarsForCaptureReplay();
}
// WGL tests are currently disabled. // WGL tests are currently disabled.
if (mFixture->wglWindow) if (mFixture->wglWindow)
{ {
...@@ -632,7 +643,7 @@ void ANGLETestBase::ANGLETestTearDown() ...@@ -632,7 +643,7 @@ void ANGLETestBase::ANGLETestTearDown()
WriteDebugMessage("Exiting %s.%s\n", info->test_case_name(), info->name()); WriteDebugMessage("Exiting %s.%s\n", info->test_case_name(), info->name());
} }
if (mCurrentParams->noFixture) if (mCurrentParams->noFixture || !mFixture->osWindow->valid())
{ {
return; return;
} }
......
...@@ -279,6 +279,8 @@ bool EGLWindow::initializeSurface(OSWindow *osWindow, ...@@ -279,6 +279,8 @@ bool EGLWindow::initializeSurface(OSWindow *osWindow,
const char *displayExtensions = eglQueryString(mDisplay, EGL_EXTENSIONS); const char *displayExtensions = eglQueryString(mDisplay, EGL_EXTENSIONS);
std::vector<EGLint> configAttributes = { std::vector<EGLint> configAttributes = {
EGL_SURFACE_TYPE,
EGL_WINDOW_BIT,
EGL_RED_SIZE, EGL_RED_SIZE,
(mConfigParams.redBits >= 0) ? mConfigParams.redBits : EGL_DONT_CARE, (mConfigParams.redBits >= 0) ? mConfigParams.redBits : EGL_DONT_CARE,
EGL_GREEN_SIZE, EGL_GREEN_SIZE,
...@@ -605,7 +607,9 @@ bool EGLWindow::isGLInitialized() const ...@@ -605,7 +607,9 @@ bool EGLWindow::isGLInitialized() const
} }
// Find an EGLConfig that is an exact match for the specified attributes. EGL_FALSE is returned if // Find an EGLConfig that is an exact match for the specified attributes. EGL_FALSE is returned if
// the EGLConfig is found. This indicates that the EGLConfig is not supported. // the EGLConfig is found. This indicates that the EGLConfig is not supported. Surface type is
// special-cased as it's possible for a config to return support for both EGL_WINDOW_BIT and
// EGL_PBUFFER_BIT even though only one of them is requested.
EGLBoolean EGLWindow::FindEGLConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *config) EGLBoolean EGLWindow::FindEGLConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *config)
{ {
EGLint numConfigs = 0; EGLint numConfigs = 0;
...@@ -625,7 +629,9 @@ EGLBoolean EGLWindow::FindEGLConfig(EGLDisplay dpy, const EGLint *attrib_list, E ...@@ -625,7 +629,9 @@ EGLBoolean EGLWindow::FindEGLConfig(EGLDisplay dpy, const EGLint *attrib_list, E
EGLint actualValue = EGL_DONT_CARE; EGLint actualValue = EGL_DONT_CARE;
eglGetConfigAttrib(dpy, allConfigs[i], curAttrib[0], &actualValue); eglGetConfigAttrib(dpy, allConfigs[i], curAttrib[0], &actualValue);
if (curAttrib[1] != actualValue) if ((curAttrib[0] == EGL_SURFACE_TYPE &&
(curAttrib[1] & actualValue) != curAttrib[1]) ||
(curAttrib[0] != EGL_SURFACE_TYPE && curAttrib[1] != actualValue))
{ {
matchFound = false; matchFound = false;
break; break;
......
...@@ -351,6 +351,12 @@ OSWindow::OSWindow() : mX(0), mY(0), mWidth(0), mHeight(0) {} ...@@ -351,6 +351,12 @@ OSWindow::OSWindow() : mX(0), mY(0), mWidth(0), mHeight(0) {}
OSWindow::~OSWindow() {} OSWindow::~OSWindow() {}
bool OSWindow::initialize(const std::string &name, int width, int height)
{
mValid = initializeImpl(name, width, height);
return mValid;
}
int OSWindow::getX() const int OSWindow::getX() const
{ {
return mX; return mX;
......
...@@ -25,7 +25,7 @@ class ANGLE_UTIL_EXPORT OSWindow ...@@ -25,7 +25,7 @@ class ANGLE_UTIL_EXPORT OSWindow
static OSWindow *New(); static OSWindow *New();
static void Delete(OSWindow **osWindow); static void Delete(OSWindow **osWindow);
virtual bool initialize(const std::string &name, int width, int height) = 0; bool initialize(const std::string &name, int width, int height);
virtual void destroy() = 0; virtual void destroy() = 0;
virtual void disableErrorMessageDialog() = 0; virtual void disableErrorMessageDialog() = 0;
...@@ -65,16 +65,23 @@ class ANGLE_UTIL_EXPORT OSWindow ...@@ -65,16 +65,23 @@ class ANGLE_UTIL_EXPORT OSWindow
// Pops events look for the test event // Pops events look for the test event
bool didTestEventFire(); bool didTestEventFire();
// Whether window has been successfully initialized.
bool valid() const { return mValid; }
protected: protected:
OSWindow(); OSWindow();
virtual ~OSWindow(); virtual ~OSWindow();
virtual bool initializeImpl(const std::string &name, int width, int height) = 0;
int mX; int mX;
int mY; int mY;
int mWidth; int mWidth;
int mHeight; int mHeight;
std::list<Event> mEvents; std::list<Event> mEvents;
bool mValid;
}; };
#endif // UTIL_OSWINDOW_H_ #endif // UTIL_OSWINDOW_H_
...@@ -60,7 +60,7 @@ AndroidWindow::AndroidWindow() {} ...@@ -60,7 +60,7 @@ AndroidWindow::AndroidWindow() {}
AndroidWindow::~AndroidWindow() {} AndroidWindow::~AndroidWindow() {}
bool AndroidWindow::initialize(const std::string &name, int width, int height) bool AndroidWindow::initializeImpl(const std::string &name, int width, int height)
{ {
return resize(width, height); return resize(width, height);
} }
...@@ -73,7 +73,7 @@ void AndroidWindow::resetNativeWindow() {} ...@@ -73,7 +73,7 @@ void AndroidWindow::resetNativeWindow() {}
EGLNativeWindowType AndroidWindow::getNativeWindow() const EGLNativeWindowType AndroidWindow::getNativeWindow() const
{ {
// Return the entire Activity Surface for now // Return the entire Activity Surface for now
// sApp->window is valid only after sInitWindowDone, which is true after initialize() // sApp->window is valid only after sInitWindowDone, which is true after initializeImpl()
return sApp->window; return sApp->window;
} }
...@@ -180,7 +180,7 @@ void android_main(struct android_app *app) ...@@ -180,7 +180,7 @@ void android_main(struct android_app *app)
// Message loop, polling for events indefinitely (due to -1 timeout) // Message loop, polling for events indefinitely (due to -1 timeout)
// Must be here in order to handle APP_CMD_INIT_WINDOW event, // Must be here in order to handle APP_CMD_INIT_WINDOW event,
// which occurs after AndroidWindow::initialize(), but before AndroidWindow::messageLoop // which occurs after AndroidWindow::initializeImpl(), but before AndroidWindow::messageLoop
while (ALooper_pollAll(-1, nullptr, &events, reinterpret_cast<void **>(&source)) >= 0) while (ALooper_pollAll(-1, nullptr, &events, reinterpret_cast<void **>(&source)) >= 0)
{ {
if (source != nullptr) if (source != nullptr)
......
...@@ -17,7 +17,6 @@ class AndroidWindow : public OSWindow ...@@ -17,7 +17,6 @@ class AndroidWindow : public OSWindow
AndroidWindow(); AndroidWindow();
~AndroidWindow() override; ~AndroidWindow() override;
bool initialize(const std::string &name, int width, int height) override;
void disableErrorMessageDialog() override; void disableErrorMessageDialog() override;
void destroy() override; void destroy() override;
...@@ -34,6 +33,9 @@ class AndroidWindow : public OSWindow ...@@ -34,6 +33,9 @@ class AndroidWindow : public OSWindow
void setVisible(bool isVisible) override; void setVisible(bool isVisible) override;
void signalTestEvent() override; void signalTestEvent() override;
private:
bool initializeImpl(const std::string &name, int width, int height) override;
}; };
#endif /* UTIL_ANDROID_WINDOW_H_ */ #endif /* UTIL_ANDROID_WINDOW_H_ */
...@@ -80,7 +80,7 @@ ScenicWindow::~ScenicWindow() ...@@ -80,7 +80,7 @@ ScenicWindow::~ScenicWindow()
destroy(); destroy();
} }
bool ScenicWindow::initialize(const std::string &name, int width, int height) bool ScenicWindow::initializeImpl(const std::string &name, int width, int height)
{ {
// Set up scenic resources. // Set up scenic resources.
mShape.SetEventMask(fuchsia::ui::gfx::kMetricsEventMask); mShape.SetEventMask(fuchsia::ui::gfx::kMetricsEventMask);
......
...@@ -43,7 +43,6 @@ class ANGLE_UTIL_EXPORT ScenicWindow : public OSWindow ...@@ -43,7 +43,6 @@ class ANGLE_UTIL_EXPORT ScenicWindow : public OSWindow
~ScenicWindow() override; ~ScenicWindow() override;
// OSWindow: // OSWindow:
bool initialize(const std::string &name, int width, int height) override;
void disableErrorMessageDialog() override; void disableErrorMessageDialog() override;
void destroy() override; void destroy() override;
void resetNativeWindow() override; void resetNativeWindow() override;
...@@ -71,6 +70,7 @@ class ANGLE_UTIL_EXPORT ScenicWindow : public OSWindow ...@@ -71,6 +70,7 @@ class ANGLE_UTIL_EXPORT ScenicWindow : public OSWindow
void onViewProperties(const fuchsia::ui::gfx::ViewProperties &properties); void onViewProperties(const fuchsia::ui::gfx::ViewProperties &properties);
private: private:
bool initializeImpl(const std::string &name, int width, int height) override;
void updateViewSize(); void updateViewSize();
// ScenicWindow async loop. // ScenicWindow async loop.
......
...@@ -35,7 +35,6 @@ class OSXWindow : public OSWindow ...@@ -35,7 +35,6 @@ class OSXWindow : public OSWindow
OSXWindow(); OSXWindow();
~OSXWindow() override; ~OSXWindow() override;
bool initialize(const std::string &name, int width, int height) override;
void disableErrorMessageDialog() override; void disableErrorMessageDialog() override;
void destroy() override; void destroy() override;
...@@ -56,6 +55,8 @@ class OSXWindow : public OSWindow ...@@ -56,6 +55,8 @@ class OSXWindow : public OSWindow
NSWindow *getNSWindow() const; NSWindow *getNSWindow() const;
private: private:
bool initializeImpl(const std::string &name, int width, int height) override;
NSWindow *mWindow; NSWindow *mWindow;
WindowDelegate *mDelegate; WindowDelegate *mDelegate;
ContentView *mView; ContentView *mView;
......
...@@ -622,7 +622,7 @@ OSXWindow::~OSXWindow() ...@@ -622,7 +622,7 @@ OSXWindow::~OSXWindow()
destroy(); destroy();
} }
bool OSXWindow::initialize(const std::string &name, int width, int height) bool OSXWindow::initializeImpl(const std::string &name, int width, int height)
{ {
if (!InitializeAppKit()) if (!InitializeAppKit())
{ {
......
...@@ -16,7 +16,7 @@ OzoneWindow::OzoneWindow() {} ...@@ -16,7 +16,7 @@ OzoneWindow::OzoneWindow() {}
OzoneWindow::~OzoneWindow() {} OzoneWindow::~OzoneWindow() {}
bool OzoneWindow::initialize(const std::string &name, int width, int height) bool OzoneWindow::initializeImpl(const std::string &name, int width, int height)
{ {
mNative.x = mX = 0; mNative.x = mX = 0;
mNative.y = mY = 0; mNative.y = mY = 0;
......
...@@ -19,7 +19,6 @@ class OzoneWindow : public OSWindow ...@@ -19,7 +19,6 @@ class OzoneWindow : public OSWindow
OzoneWindow(); OzoneWindow();
~OzoneWindow() override; ~OzoneWindow() override;
bool initialize(const std::string &name, int width, int height) override;
void disableErrorMessageDialog() override; void disableErrorMessageDialog() override;
void destroy() override; void destroy() override;
...@@ -38,6 +37,8 @@ class OzoneWindow : public OSWindow ...@@ -38,6 +37,8 @@ class OzoneWindow : public OSWindow
void signalTestEvent() override; void signalTestEvent() override;
private: private:
bool initializeImpl(const std::string &name, int width, int height) override;
struct Native struct Native
{ {
int32_t x; int32_t x;
......
...@@ -498,7 +498,7 @@ Win32Window::~Win32Window() ...@@ -498,7 +498,7 @@ Win32Window::~Win32Window()
destroy(); destroy();
} }
bool Win32Window::initialize(const std::string &name, int width, int height) bool Win32Window::initializeImpl(const std::string &name, int width, int height)
{ {
destroy(); destroy();
......
...@@ -21,7 +21,6 @@ class Win32Window : public OSWindow ...@@ -21,7 +21,6 @@ class Win32Window : public OSWindow
Win32Window(); Win32Window();
~Win32Window() override; ~Win32Window() override;
bool initialize(const std::string &name, int width, int height) override;
void destroy() override; void destroy() override;
void disableErrorMessageDialog() override; void disableErrorMessageDialog() override;
...@@ -44,6 +43,7 @@ class Win32Window : public OSWindow ...@@ -44,6 +43,7 @@ class Win32Window : public OSWindow
void signalTestEvent() override; void signalTestEvent() override;
private: private:
bool initializeImpl(const std::string &name, int width, int height) override;
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
std::string mParentClassName; std::string mParentClassName;
......
...@@ -277,7 +277,7 @@ X11Window::~X11Window() ...@@ -277,7 +277,7 @@ X11Window::~X11Window()
destroy(); destroy();
} }
bool X11Window::initialize(const std::string &name, int width, int height) bool X11Window::initializeImpl(const std::string &name, int width, int height)
{ {
destroy(); destroy();
......
...@@ -24,7 +24,6 @@ class ANGLE_UTIL_EXPORT X11Window : public OSWindow ...@@ -24,7 +24,6 @@ class ANGLE_UTIL_EXPORT X11Window : public OSWindow
X11Window(int visualId); X11Window(int visualId);
~X11Window() override; ~X11Window() override;
bool initialize(const std::string &name, int width, int height) override;
void disableErrorMessageDialog() override; void disableErrorMessageDialog() override;
void destroy() override; void destroy() override;
...@@ -43,6 +42,7 @@ class ANGLE_UTIL_EXPORT X11Window : public OSWindow ...@@ -43,6 +42,7 @@ class ANGLE_UTIL_EXPORT X11Window : public OSWindow
void signalTestEvent() override; void signalTestEvent() override;
private: private:
bool initializeImpl(const std::string &name, int width, int height) override;
void processEvent(const XEvent &event); void processEvent(const XEvent &event);
Atom WM_DELETE_WINDOW; Atom WM_DELETE_WINDOW;
......
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