Home | History | Annotate | Download | only in deqp_tests
      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 "gtest/gtest.h"
      8 #include "deqp_tests.h"
      9 
     10 #include <EGL/eglext.h>
     11 
     12 #include <map>
     13 #include <string>
     14 #include <vector>
     15 
     16 int main(int argc, char** argv)
     17 {
     18     testing::InitGoogleTest(&argc, argv);
     19 
     20     typedef std::pair<std::string, EGLNativeDisplayType> NameDisplayTypePair;
     21     typedef std::map<std::string, EGLNativeDisplayType> DisplayTypeMap;
     22     DisplayTypeMap allDisplays;
     23     allDisplays["d3d11"] = EGL_D3D11_ONLY_DISPLAY_ANGLE;
     24 
     25     // Iterate through the command line arguments and check if they are config names
     26     std::vector<NameDisplayTypePair> requestedDisplays;
     27     for (size_t i = 1; i < static_cast<size_t>(argc); i++)
     28     {
     29         DisplayTypeMap::const_iterator iter = allDisplays.find(argv[i]);
     30         if (iter != allDisplays.end())
     31         {
     32             requestedDisplays.push_back(*iter);
     33         }
     34     }
     35 
     36     // If no configs were requested, run them all
     37     if (requestedDisplays.empty())
     38     {
     39         for (DisplayTypeMap::const_iterator i = allDisplays.begin(); i != allDisplays.end(); i++)
     40         {
     41             requestedDisplays.push_back(*i);
     42         }
     43     }
     44 
     45     // Run each requested config
     46     int rt = 0;
     47     for (size_t i = 0; i < requestedDisplays.size(); i++)
     48     {
     49         DEQPConfig config;
     50         config.displayType = requestedDisplays[i].second;
     51         config.width = 256;
     52         config.height = 256;
     53         config.hidden = false;
     54 
     55         SetCurrentConfig(config);
     56 
     57         std::cout << "Running test configuration \"" << requestedDisplays[i].first << "\".\n";
     58 
     59         rt |= RUN_ALL_TESTS();
     60     }
     61 
     62     return rt;
     63 }
     64