Edit

kc3-lang/angle/tests/deqp_tests/deqp_test_main.cpp

Branch :

  • Show log

    Commit

  • Author : Geoff Lang
    Date : 2014-05-16 10:37:47
    Hash : 5df9f523
    Message : Automate the DEQP tests by wrapping them in the gtest suite. BUG=angle:497 Change-Id: If0a72c053bccccc4369ec78dd70173bbadb1be7b Reviewed-on: https://chromium-review.googlesource.com/200044 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>

  • tests/deqp_tests/deqp_test_main.cpp
  • //
    // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    
    #include "gtest/gtest.h"
    #include "deqp_tests.h"
    
    #include <EGL/eglext.h>
    
    #include <map>
    #include <string>
    #include <vector>
    
    int main(int argc, char** argv)
    {
        testing::InitGoogleTest(&argc, argv);
    
        typedef std::pair<std::string, EGLNativeDisplayType> NameDisplayTypePair;
        typedef std::map<std::string, EGLNativeDisplayType> DisplayTypeMap;
        DisplayTypeMap allDisplays;
        allDisplays["d3d11"] = EGL_D3D11_ONLY_DISPLAY_ANGLE;
    
        // Iterate through the command line arguments and check if they are config names
        std::vector<NameDisplayTypePair> requestedDisplays;
        for (size_t i = 1; i < static_cast<size_t>(argc); i++)
        {
            DisplayTypeMap::const_iterator iter = allDisplays.find(argv[i]);
            if (iter != allDisplays.end())
            {
                requestedDisplays.push_back(*iter);
            }
        }
    
        // If no configs were requested, run them all
        if (requestedDisplays.empty())
        {
            for (DisplayTypeMap::const_iterator i = allDisplays.begin(); i != allDisplays.end(); i++)
            {
                requestedDisplays.push_back(*i);
            }
        }
    
        // Run each requested config
        int rt = 0;
        for (size_t i = 0; i < requestedDisplays.size(); i++)
        {
            DEQPConfig config;
            config.displayType = requestedDisplays[i].second;
            config.width = 256;
            config.height = 256;
            config.hidden = false;
    
            SetCurrentConfig(config);
    
            std::cout << "Running test configuration \"" << requestedDisplays[i].first << "\".\n";
    
            rt |= RUN_ALL_TESTS();
        }
    
        return rt;
    }