| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/gles2_conform_support/gles2_conform_test.h" | 5 #include "gpu/gles2_conform_support/gles2_conform_test.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 gpu::GPUTestExpectationsParser test_expectations; | 37 gpu::GPUTestExpectationsParser test_expectations; |
| 38 if (!test_expectations.LoadTestExpectations(test_expectations_path)) { | 38 if (!test_expectations.LoadTestExpectations(test_expectations_path)) { |
| 39 LOG(ERROR) << "Fail to load gles2_conform_test_expectations.txt"; | 39 LOG(ERROR) << "Fail to load gles2_conform_test_expectations.txt"; |
| 40 return false; | 40 return false; |
| 41 } | 41 } |
| 42 gpu::GPUTestBotConfig bot_config; | 42 gpu::GPUTestBotConfig bot_config; |
| 43 if (!bot_config.LoadCurrentConfig(NULL)) { | 43 if (!bot_config.LoadCurrentConfig(NULL)) { |
| 44 LOG(ERROR) << "Fail to load bot configuration"; | 44 LOG(ERROR) << "Fail to load bot configuration"; |
| 45 return false; | 45 return false; |
| 46 } | 46 } |
| 47 | |
| 48 // Set the bot config api based on the OS and command line | |
| 49 base::CommandLine* current_cmd_line = base::CommandLine::ForCurrentProcess(); | |
| 50 int32 config_os = bot_config.os(); | |
| 51 if ((config_os & gpu::GPUTestConfig::kOsWin) != 0) { | |
| 52 std::string angle_renderer = | |
| 53 current_cmd_line->HasSwitch("use-angle") | |
| 54 ? current_cmd_line->GetSwitchValueASCII("use-angle") | |
| 55 : "d3d11"; | |
| 56 if (angle_renderer == "d3d11") { | |
| 57 bot_config.set_api(gpu::GPUTestConfig::kAPID3D11); | |
| 58 } else if (angle_renderer == "d3d9") { | |
| 59 bot_config.set_api(gpu::GPUTestConfig::kAPID3D9); | |
| 60 } else if (angle_renderer == "gl") { | |
| 61 bot_config.set_api(gpu::GPUTestConfig::kAPIGLDesktop); | |
| 62 } else if (angle_renderer == "gles") { | |
| 63 bot_config.set_api(gpu::GPUTestConfig::kAPIGLES); | |
| 64 } else { | |
| 65 bot_config.set_api(gpu::GPUTestConfig::kAPIUnknown); | |
| 66 } | |
| 67 } else if ((config_os & gpu::GPUTestConfig::kOsMac) != 0 || | |
| 68 config_os == gpu::GPUTestConfig::kOsLinux) { | |
| 69 bot_config.set_api(gpu::GPUTestConfig::kAPIGLDesktop); | |
| 70 } else if (config_os == gpu::GPUTestConfig::kOsChromeOS || | |
| 71 config_os == gpu::GPUTestConfig::kOsAndroid) { | |
| 72 bot_config.set_api(gpu::GPUTestConfig::kAPIGLES); | |
| 73 } else { | |
| 74 bot_config.set_api(gpu::GPUTestConfig::kAPIUnknown); | |
| 75 } | |
| 76 | |
| 77 if (!bot_config.IsValid()) { | 47 if (!bot_config.IsValid()) { |
| 78 LOG(ERROR) << "Invalid bot configuration"; | 48 LOG(ERROR) << "Invalid bot configuration"; |
| 79 return false; | 49 return false; |
| 80 } | 50 } |
| 81 std::string path_string(path); | 51 std::string path_string(path); |
| 82 std::string test_name; | 52 std::string test_name; |
| 83 base::ReplaceChars(path_string, "\\/.", "_", &test_name); | 53 base::ReplaceChars(path_string, "\\/.", "_", &test_name); |
| 84 int32 expectation = | 54 int32 expectation = |
| 85 test_expectations.GetTestExpectation(test_name, bot_config); | 55 test_expectations.GetTestExpectation(test_name, bot_config); |
| 86 if (expectation != gpu::GPUTestExpectationsParser::kGpuTestPass) { | 56 if (expectation != gpu::GPUTestExpectationsParser::kGpuTestPass) { |
| 87 LOG(WARNING) << "Test " << test_name << " is bypassed"; | 57 LOG(WARNING) << "Test " << test_name << " is bypassed"; |
| 88 return true; | 58 return true; |
| 89 } | 59 } |
| 90 | 60 |
| 91 base::FilePath test_path; | 61 base::FilePath test_path; |
| 92 PathService::Get(base::DIR_EXE, &test_path); | 62 PathService::Get(base::DIR_EXE, &test_path); |
| 93 base::FilePath program(test_path.Append(FILE_PATH_LITERAL( | 63 base::FilePath program(test_path.Append(FILE_PATH_LITERAL( |
| 94 "gles2_conform_test_windowless"))); | 64 "gles2_conform_test_windowless"))); |
| 95 | 65 |
| 66 base::CommandLine* currentCmdLine = base::CommandLine::ForCurrentProcess(); |
| 96 base::CommandLine cmdline(program); | 67 base::CommandLine cmdline(program); |
| 97 cmdline.AppendArguments(*currentCmdLine, false); | 68 cmdline.AppendArguments(*currentCmdLine, false); |
| 98 cmdline.AppendSwitch(std::string("--")); | 69 cmdline.AppendSwitch(std::string("--")); |
| 99 cmdline.AppendArg(std::string("-run=") + path); | 70 cmdline.AppendArg(std::string("-run=") + path); |
| 100 | 71 |
| 101 std::string output; | 72 std::string output; |
| 102 bool success = base::GetAppOutput(cmdline, &output); | 73 bool success = base::GetAppOutput(cmdline, &output); |
| 103 if (success) { | 74 if (success) { |
| 104 size_t success_index = output.find("Conformance PASSED all"); | 75 size_t success_index = output.find("Conformance PASSED all"); |
| 105 size_t failed_index = output.find("FAILED"); | 76 size_t failed_index = output.find("FAILED"); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 117 base::CommandLine::Init(argc, argv); | 88 base::CommandLine::Init(argc, argv); |
| 118 #if defined(OS_MACOSX) | 89 #if defined(OS_MACOSX) |
| 119 base::mac::ScopedNSAutoreleasePool pool; | 90 base::mac::ScopedNSAutoreleasePool pool; |
| 120 #endif | 91 #endif |
| 121 ::testing::InitGoogleTest(&argc, argv); | 92 ::testing::InitGoogleTest(&argc, argv); |
| 122 return RUN_ALL_TESTS(); | 93 return RUN_ALL_TESTS(); |
| 123 } | 94 } |
| 124 | 95 |
| 125 | 96 |
| 126 | 97 |
| OLD | NEW |