Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(768)

Side by Side Diff: gpu/gles2_conform_support/gles2_conform_test.cc

Issue 1277253002: Apply the bot config api based on the command line arguments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gpu/gles2_conform_support/gles2_conform_test_expectations.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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* currentCmdLine = base::CommandLine::ForCurrentProcess();
Zhenyao Mo 2015/08/18 13:36:01 current_cmd_line
Geoff Lang 2015/08/18 14:06:09 Whoops, fixed.
50 int32 config_os = bot_config.os();
51 if ((config_os & gpu::GPUTestConfig::kOsWin) != 0) {
52 std::string angle_renderer =
53 currentCmdLine->HasSwitch("use-angle")
54 ? currentCmdLine->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
47 if (!bot_config.IsValid()) { 77 if (!bot_config.IsValid()) {
48 LOG(ERROR) << "Invalid bot configuration"; 78 LOG(ERROR) << "Invalid bot configuration";
49 return false; 79 return false;
50 } 80 }
51 std::string path_string(path); 81 std::string path_string(path);
52 std::string test_name; 82 std::string test_name;
53 base::ReplaceChars(path_string, "\\/.", "_", &test_name); 83 base::ReplaceChars(path_string, "\\/.", "_", &test_name);
54 int32 expectation = 84 int32 expectation =
55 test_expectations.GetTestExpectation(test_name, bot_config); 85 test_expectations.GetTestExpectation(test_name, bot_config);
56 if (expectation != gpu::GPUTestExpectationsParser::kGpuTestPass) { 86 if (expectation != gpu::GPUTestExpectationsParser::kGpuTestPass) {
57 LOG(WARNING) << "Test " << test_name << " is bypassed"; 87 LOG(WARNING) << "Test " << test_name << " is bypassed";
58 return true; 88 return true;
59 } 89 }
60 90
61 base::FilePath test_path; 91 base::FilePath test_path;
62 PathService::Get(base::DIR_EXE, &test_path); 92 PathService::Get(base::DIR_EXE, &test_path);
63 base::FilePath program(test_path.Append(FILE_PATH_LITERAL( 93 base::FilePath program(test_path.Append(FILE_PATH_LITERAL(
64 "gles2_conform_test_windowless"))); 94 "gles2_conform_test_windowless")));
65 95
66 base::CommandLine* currentCmdLine = base::CommandLine::ForCurrentProcess();
67 base::CommandLine cmdline(program); 96 base::CommandLine cmdline(program);
68 cmdline.AppendArguments(*currentCmdLine, false); 97 cmdline.AppendArguments(*currentCmdLine, false);
69 cmdline.AppendSwitch(std::string("--")); 98 cmdline.AppendSwitch(std::string("--"));
70 cmdline.AppendArg(std::string("-run=") + path); 99 cmdline.AppendArg(std::string("-run=") + path);
71 100
72 std::string output; 101 std::string output;
73 bool success = base::GetAppOutput(cmdline, &output); 102 bool success = base::GetAppOutput(cmdline, &output);
74 if (success) { 103 if (success) {
75 size_t success_index = output.find("Conformance PASSED all"); 104 size_t success_index = output.find("Conformance PASSED all");
76 size_t failed_index = output.find("FAILED"); 105 size_t failed_index = output.find("FAILED");
(...skipping 11 matching lines...) Expand all
88 base::CommandLine::Init(argc, argv); 117 base::CommandLine::Init(argc, argv);
89 #if defined(OS_MACOSX) 118 #if defined(OS_MACOSX)
90 base::mac::ScopedNSAutoreleasePool pool; 119 base::mac::ScopedNSAutoreleasePool pool;
91 #endif 120 #endif
92 ::testing::InitGoogleTest(&argc, argv); 121 ::testing::InitGoogleTest(&argc, argv);
93 return RUN_ALL_TESTS(); 122 return RUN_ALL_TESTS();
94 } 123 }
95 124
96 125
97 126
OLDNEW
« no previous file with comments | « no previous file | gpu/gles2_conform_support/gles2_conform_test_expectations.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698