diff options
Diffstat (limited to 'gfx/angle/src/tests/deqp_support/angle_deqp_gtest.cpp')
-rwxr-xr-x | gfx/angle/src/tests/deqp_support/angle_deqp_gtest.cpp | 157 |
1 files changed, 8 insertions, 149 deletions
diff --git a/gfx/angle/src/tests/deqp_support/angle_deqp_gtest.cpp b/gfx/angle/src/tests/deqp_support/angle_deqp_gtest.cpp index 89f3f8a42..f3dbb5cad 100755 --- a/gfx/angle/src/tests/deqp_support/angle_deqp_gtest.cpp +++ b/gfx/angle/src/tests/deqp_support/angle_deqp_gtest.cpp @@ -45,50 +45,6 @@ const char *g_TestExpectationsFiles[] = { "deqp_gles31_test_expectations.txt", "deqp_egl_test_expectations.txt", }; -using APIInfo = std::pair<const char *, gpu::GPUTestConfig::API>; - -const APIInfo g_eglDisplayAPIs[] = { - {"angle-d3d9", gpu::GPUTestConfig::kAPID3D9}, - {"angle-d3d11", gpu::GPUTestConfig::kAPID3D11}, - {"angle-gl", gpu::GPUTestConfig::kAPIGLDesktop}, - {"angle-gles", gpu::GPUTestConfig::kAPIGLES}, -}; - -const APIInfo *g_initAPI = nullptr; - -// Returns the default API for a platform. -const char *GetDefaultAPIName() -{ -#if defined(ANGLE_PLATFORM_WINDOWS) - return "angle-d3d11"; -#elif defined(ANGLE_PLATFORM_APPLE) || defined(ANGLE_PLATFORM_LINUX) - return "angle-gl"; -#elif defined(ANGLE_PLATFORM_ANDROID) - return "angle-gles"; -#else -#error Unknown platform. -#endif -} - -const APIInfo *FindAPIInfo(const std::string &arg) -{ - for (auto &displayAPI : g_eglDisplayAPIs) - { - if (arg == displayAPI.first) - { - return &displayAPI; - } - } - return nullptr; -} - -const APIInfo *GetDefaultAPIInfo() -{ - const APIInfo *defaultInfo = FindAPIInfo(GetDefaultAPIName()); - ASSERT(defaultInfo); - return defaultInfo; -} - // During the CaseList initialization we cannot use the GTEST FAIL macro to quit the program because // the initialization is called outside of tests the first time. void Die() @@ -206,16 +162,6 @@ void dEQPCaseList::initialize() Die(); } - // Set the API from the command line, or using the default platform API. - if (g_initAPI) - { - mTestConfig.set_api(g_initAPI->second); - } - else - { - mTestConfig.set_api(GetDefaultAPIInfo()->second); - } - std::ifstream caseListStream(caseListPath); if (caseListStream.fail()) { @@ -269,7 +215,13 @@ class dEQPTest : public testing::TestWithParam<size_t> return sCaseList; } - static void SetUpTestCase(); + static void SetUpTestCase() + { + sPasses = 0; + sFails = 0; + sUnexpectedPasses = 0; + } + static void TearDownTestCase(); protected: @@ -311,33 +263,6 @@ unsigned int dEQPTest<TestModuleIndex>::sUnexpectedPasses = 0; // static template <size_t TestModuleIndex> -void dEQPTest<TestModuleIndex>::SetUpTestCase() -{ - sPasses = 0; - sFails = 0; - sUnexpectedPasses = 0; - - int argc = 0; - std::vector<const char *> argv; - - // Reserve one argument for the binary name. - argc++; - argv.push_back(""); - - // Add init api. - argc++; - argv.push_back(g_initAPI ? g_initAPI->first : GetDefaultAPIName()); - - // Init the platform. - if (!deqp_libtester_init_platform(argc, argv.data())) - { - std::cout << "Aborting test due to dEQP initialization error." << std::endl; - exit(1); - } -} - -// static -template <size_t TestModuleIndex> void dEQPTest<TestModuleIndex>::TearDownTestCase() { unsigned int total = sPasses + sFails; @@ -354,10 +279,9 @@ void dEQPTest<TestModuleIndex>::TearDownTestCase() { std::cout << sUnexpectedPasses << " tests unexpectedly passed." << std::endl; } - - deqp_libtester_shutdown_platform(); } +// TODO(jmadill): add different platform configs, or ability to choose platform #define ANGLE_INSTANTIATE_DEQP_TEST_CASE(DEQP_TEST, N) \ class DEQP_TEST : public dEQPTest<N> \ { \ @@ -385,69 +309,4 @@ ANGLE_INSTANTIATE_DEQP_TEST_CASE(dEQP_GLES31, 2); ANGLE_INSTANTIATE_DEQP_TEST_CASE(dEQP_EGL, 3); #endif -const char *g_deqpEGLString = "--deqp-egl-display-type="; -const char *g_angleEGLString = "--use-angle="; - -void HandleDisplayType(const char *displayTypeString) -{ - std::stringstream argStream; - - if (g_initAPI) - { - std::cout << "Cannot specify two EGL displays!" << std::endl; - exit(1); - } - - if (strncmp(displayTypeString, "angle-", strlen("angle-")) != 0) - { - argStream << "angle-"; - } - - argStream << displayTypeString; - std::string arg = argStream.str(); - - g_initAPI = FindAPIInfo(arg); - - if (!g_initAPI) - { - std::cout << "Unknown ANGLE back-end API: " << displayTypeString << std::endl; - exit(1); - } -} - -void DeleteArg(int *argc, int argIndex, char **argv) -{ - (*argc)--; - for (int moveIndex = argIndex; moveIndex < *argc; ++moveIndex) - { - argv[moveIndex] = argv[moveIndex + 1]; - } -} - } // anonymous namespace - -// Called from main() to process command-line arguments. -namespace angle -{ -void InitTestHarness(int *argc, char **argv) -{ - int argIndex = 0; - while (argIndex < *argc) - { - if (strncmp(argv[argIndex], g_deqpEGLString, strlen(g_deqpEGLString)) == 0) - { - HandleDisplayType(argv[argIndex] + strlen(g_deqpEGLString)); - DeleteArg(argc, argIndex, argv); - } - else if (strncmp(argv[argIndex], g_angleEGLString, strlen(g_angleEGLString)) == 0) - { - HandleDisplayType(argv[argIndex] + strlen(g_angleEGLString)); - DeleteArg(argc, argIndex, argv); - } - else - { - argIndex++; - } - } -} -} // namespace angle |