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

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

Issue 105733002: Move src/gpu/gles2_conform_test out of src-internal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "gpu/gles2_conform_support/gles2_conform_test.h"
6
7 #include <string>
8
9 #include "base/at_exit.h"
10 #include "base/base_paths.h"
11 #include "base/command_line.h"
12 #include "base/file_util.h"
13 #include "base/files/file_path.h"
14 #include "base/logging.h"
15 #if defined(OS_MACOSX)
16 #include "base/mac/scoped_nsautorelease_pool.h"
17 #endif
18 #include "base/path_service.h"
19 #include "base/process/launch.h"
20 #include "base/strings/string_util.h"
21 #include "gpu/config/gpu_test_config.h"
22 #include "gpu/config/gpu_test_expectations_parser.h"
23 #include "testing/gtest/include/gtest/gtest.h"
24
25 bool RunGLES2ConformTest(const char* path) {
26 // Load test expectations, and return early if a test is marked as FAIL.
27 base::FilePath src_path;
28 PathService::Get(base::DIR_SOURCE_ROOT, &src_path);
29 base::FilePath test_expectations_path =
30 src_path.Append(FILE_PATH_LITERAL("gpu")).
31 Append(FILE_PATH_LITERAL("gles2_conform_support")).
32 Append(FILE_PATH_LITERAL("gles2_conform_test_expectations.txt"));
33 if (!base::PathExists(test_expectations_path)) {
34 LOG(ERROR) << "Fail to locate gles2_conform_test_expectations.txt";
35 return false;
36 }
37 gpu::GPUTestExpectationsParser test_expectations;
38 if (!test_expectations.LoadTestExpectations(test_expectations_path)) {
39 LOG(ERROR) << "Fail to load gles2_conform_test_expectations.txt";
40 return false;
41 }
42 gpu::GPUTestBotConfig bot_config;
43 if (!bot_config.LoadCurrentConfig(NULL)) {
44 LOG(ERROR) << "Fail to load bot configuration";
45 return false;
46 }
47 if (!bot_config.IsValid()) {
48 LOG(ERROR) << "Invalid bot configuration";
49 return false;
50 }
51 std::string path_string(path);
52 std::string test_name;
53 base::ReplaceChars(path_string, "\\/.", "_", &test_name);
54 int32 expectation =
55 test_expectations.GetTestExpectation(test_name, bot_config);
56 if (expectation != gpu::GPUTestExpectationsParser::kGpuTestPass) {
57 LOG(WARNING) << "Test " << test_name << " is bypassed";
58 return true;
59 }
60
61 base::FilePath test_path;
62 PathService::Get(base::DIR_EXE, &test_path);
63 base::FilePath program(test_path.Append(FILE_PATH_LITERAL(
64 "gles2_conform_test_windowless")));
65
66 CommandLine cmdline(program);
67 cmdline.AppendSwitch(std::string("-run=") + path);
68
69 std::string output;
70 bool success = base::GetAppOutput(cmdline, &output);
71 if (success) {
72 size_t success_index = output.find("Conformance PASSED all");
73 size_t failed_index = output.find("FAILED");
74 success = (success_index != std::string::npos) &&
75 (failed_index == std::string::npos);
76 }
77 if (!success) {
78 LOG(ERROR) << output;
79 }
80 return success;
81 }
82
83 int main(int argc, char** argv) {
84 base::AtExitManager exit_manager;
85 #if defined(OS_MACOSX)
86 base::mac::ScopedNSAutoreleasePool pool;
87 #endif
88 ::testing::InitGoogleTest(&argc, argv);
89 return RUN_ALL_TESTS();
90 }
91
92
93
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698