1// 2// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3// Use of this source code is governed by a BSD-style license that can be 4// found in the LICENSE file. 5// 6 7#include "gles_conformance_tests.h" 8 9#include "gtest/gtest.h" 10 11#include <EGL/egl.h> 12#include <EGL/eglext.h> 13 14#include <map> 15#include <string> 16#include <vector> 17 18#define CONFORMANCE_TESTS_ES2 2 19#define CONFORMANCE_TESTS_ES3 3 20 21int main(int argc, char** argv) 22{ 23 testing::InitGoogleTest(&argc, argv); 24 25 typedef std::pair<std::string, EGLNativeDisplayType> NameDisplayTypePair; 26 typedef std::map<std::string, EGLNativeDisplayType> DisplayTypeMap; 27 DisplayTypeMap allDisplays; 28 29#if CONFORMANCE_TESTS_TYPE == CONFORMANCE_TESTS_ES2 30 allDisplays["d3d9"] = EGL_DEFAULT_DISPLAY; 31 allDisplays["d3d11"] = EGL_D3D11_ONLY_DISPLAY_ANGLE; 32#elif CONFORMANCE_TESTS_TYPE == CONFORMANCE_TESTS_ES3 33 allDisplays["d3d11"] = EGL_D3D11_ONLY_DISPLAY_ANGLE; 34#else 35# error "Unknown CONFORMANCE_TESTS_TYPE" 36#endif 37 38 // Iterate through the command line arguments and check if they are config names 39 std::vector<NameDisplayTypePair> requestedDisplays; 40 for (size_t i = 1; i < static_cast<size_t>(argc); i++) 41 { 42 DisplayTypeMap::const_iterator iter = allDisplays.find(argv[i]); 43 if (iter != allDisplays.end()) 44 { 45 requestedDisplays.push_back(*iter); 46 } 47 } 48 49 // If no configs were requested, run them all 50 if (requestedDisplays.empty()) 51 { 52 for (DisplayTypeMap::const_iterator i = allDisplays.begin(); i != allDisplays.end(); i++) 53 { 54 requestedDisplays.push_back(*i); 55 } 56 } 57 58 // Run each requested config 59 int rt = 0; 60 for (size_t i = 0; i < requestedDisplays.size(); i++) 61 { 62 ConformanceConfig config = { 64, 64, requestedDisplays[i].second }; 63 SetCurrentConfig(config); 64 65 std::cout << "Running test configuration \"" << requestedDisplays[i].first << "\".\n"; 66 67 rt |= RUN_ALL_TESTS(); 68 } 69 70 return rt; 71} 72