Skip window and surface tests if glfwInit fails

This skips tests that would fail on SwiftShader on systems with
no display.

Bug: dawn:283
Change-Id: Ie3aa46349df3116305712a5aa143d874cef0d4b4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21781
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2020-05-19 20:51:23 +00:00 committed by Commit Bot service account
parent 8d6b021a2a
commit 7355460100
2 changed files with 3 additions and 2 deletions

View File

@ -32,7 +32,7 @@ class SwapChainValidationTests : public DawnTest {
glfwSetErrorCallback([](int code, const char* message) {
dawn::ErrorLog() << "GLFW error " << code << " " << message;
});
glfwInit();
DAWN_SKIP_TEST_IF(!glfwInit());
// The SwapChainValidationTests don't create devices so we don't need to call
// SetupGLFWWindowHintsForBackend. Set GLFW_NO_API anyway to avoid GLFW bringing up a GL

View File

@ -16,6 +16,7 @@
#include "common/Platform.h"
#include "dawn/dawn_proc.h"
#include "dawn_native/DawnNative.h"
#include "tests/DawnTest.h"
#include "utils/GLFWUtils.h"
#include <gtest/gtest.h>
@ -47,7 +48,7 @@ class WindowSurfaceInstanceTests : public testing::Test {
glfwSetErrorCallback([](int code, const char* message) {
dawn::ErrorLog() << "GLFW error " << code << " " << message;
});
glfwInit();
DAWN_SKIP_TEST_IF(!glfwInit());
DawnProcTable procs = dawn_native::GetProcs();
dawnProcSetProcs(&procs);