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

Side by Side Diff: client/deps/glbench/src/main.cc

Issue 2873023: Got rid of glxinfo. (Closed) Base URL: http://src.chromium.org/git/autotest.git
Patch Set: strip board id Created 10 years, 5 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 | client/site_tests/graphics_GLBench/graphics_GLBench.py » ('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) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 <gflags/gflags.h> 5 #include <gflags/gflags.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 11
12 #include "main.h" 12 #include "main.h"
13 #include "utils.h" 13 #include "utils.h"
14 14
15 #include "all_tests.h" 15 #include "all_tests.h"
16 #include "testbase.h" 16 #include "testbase.h"
17 17
18 using std::string; 18 using std::string;
19 using std::vector; 19 using std::vector;
20 20
21 DEFINE_int32(duration, 0, "run tests in a loop for at least this many seconds"); 21 DEFINE_int32(duration, 0, "run tests in a loop for at least this many seconds");
22 DEFINE_string(tests, "", "colon-separated list of tests to run; " 22 DEFINE_string(tests, "", "colon-separated list of tests to run; "
23 "all tests if omitted"); 23 "all tests if omitted");
24 DEFINE_bool(get_board_id, false, "return the board id for checksums");
24 25
25 26
26 bool test_is_enabled(glbench::TestBase* test, 27 bool test_is_enabled(glbench::TestBase* test,
27 const vector<string>& enabled_tests) { 28 const vector<string>& enabled_tests) {
28 if (enabled_tests.empty()) 29 if (enabled_tests.empty())
29 return true; 30 return true;
30 31
31 const char* test_name = test->Name(); 32 const char* test_name = test->Name();
32 for (vector<string>::const_iterator i = enabled_tests.begin(); 33 for (vector<string>::const_iterator i = enabled_tests.begin();
33 i != enabled_tests.end(); ++i) { 34 i != enabled_tests.end(); ++i) {
34 // This is not very precise, but will do until there's a need for something 35 // This is not very precise, but will do until there's a need for something
35 // more flexible. 36 // more flexible.
36 if (strstr(test_name, i->c_str())) 37 if (strstr(test_name, i->c_str()))
37 return true; 38 return true;
38 } 39 }
39 40
40 return false; 41 return false;
41 } 42 }
42 43
43 int main(int argc, char *argv[]) { 44 int main(int argc, char *argv[]) {
44 SetBasePathFromArgv0(argv[0], "src"); 45 SetBasePathFromArgv0(argv[0], "src");
45 google::ParseCommandLineFlags(&argc, &argv, true); 46 google::ParseCommandLineFlags(&argc, &argv, true);
46 if (!Init()) { 47 if (!Init()) {
47 printf("# Failed to initialize.\n"); 48 printf("# Failed to initialize.\n");
48 return 1; 49 return 1;
49 } 50 }
50 51
52 if (FLAGS_get_board_id) {
53 InitContext();
54 printf("%s / %s\n", glGetString(GL_VENDOR), glGetString(GL_RENDERER));
55 DestroyContext();
56 return 0;
57 }
58
51 vector<string> enabled_tests; 59 vector<string> enabled_tests;
52 SplitString(FLAGS_tests, ':', &enabled_tests); 60 SplitString(FLAGS_tests, ':', &enabled_tests);
53 61
54 glbench::TestBase* tests[] = { 62 glbench::TestBase* tests[] = {
55 glbench::GetSwapTest(), 63 glbench::GetSwapTest(),
56 glbench::GetClearTest(), 64 glbench::GetClearTest(),
57 #if defined(USE_OPENGL) 65 #if defined(USE_OPENGL)
58 glbench::GetFillRateTest(), 66 glbench::GetFillRateTest(),
59 glbench::GetTriangleSetupTest(), 67 glbench::GetTriangleSetupTest(),
60 glbench::GetWindowManagerCompositingTest(false), 68 glbench::GetWindowManagerCompositingTest(false),
(...skipping 17 matching lines...) Expand all
78 } 86 }
79 } while (GetUTime() < done); 87 } while (GetUTime() < done);
80 88
81 for (unsigned int i = 0; i < arraysize(tests); i++) { 89 for (unsigned int i = 0; i < arraysize(tests); i++) {
82 delete tests[i]; 90 delete tests[i];
83 tests[i] = NULL; 91 tests[i] = NULL;
84 } 92 }
85 93
86 return 0; 94 return 0;
87 } 95 }
OLDNEW
« no previous file with comments | « no previous file | client/site_tests/graphics_GLBench/graphics_GLBench.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698