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

Side by Side Diff: content/test/gpu/gpu_test_expectations_parser_unittest.cc

Issue 15827008: Move gpu_test_config stuff from content/ to gpu/ (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « content/test/gpu/gpu_test_expectations_parser.cc ('k') | gpu/config/gpu_test_config.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/logging.h"
6 #include "content/test/gpu/gpu_test_expectations_parser.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 class GPUTestExpectationsParserTest : public testing::Test {
10 public:
11 GPUTestExpectationsParserTest() { }
12
13 virtual ~GPUTestExpectationsParserTest() { }
14
15 const GPUTestBotConfig& bot_config() const {
16 return bot_config_;
17 }
18
19 protected:
20 virtual void SetUp() {
21 bot_config_.set_os(GPUTestConfig::kOsWin7);
22 bot_config_.set_build_type(GPUTestConfig::kBuildTypeRelease);
23 bot_config_.AddGPUVendor(0x10de);
24 bot_config_.set_gpu_device_id(0x0640);
25 ASSERT_TRUE(bot_config_.IsValid());
26 }
27
28 virtual void TearDown() { }
29
30 private:
31 GPUTestBotConfig bot_config_;
32 };
33
34 TEST_F(GPUTestExpectationsParserTest, CommentOnly) {
35 const std::string text =
36 " \n"
37 "// This is just some comment\n"
38 "";
39 GPUTestExpectationsParser parser;
40 EXPECT_TRUE(parser.LoadTestExpectations(text));
41 EXPECT_EQ(0u, parser.GetErrorMessages().size());
42 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass,
43 parser.GetTestExpectation("some_test", bot_config()));
44 }
45
46 TEST_F(GPUTestExpectationsParserTest, ValidFullEntry) {
47 const std::string text =
48 "BUG12345 WIN7 RELEASE NVIDIA 0x0640 : MyTest = FAIL";
49
50 GPUTestExpectationsParser parser;
51 EXPECT_TRUE(parser.LoadTestExpectations(text));
52 EXPECT_EQ(0u, parser.GetErrorMessages().size());
53 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestFail,
54 parser.GetTestExpectation("MyTest", bot_config()));
55 }
56
57 TEST_F(GPUTestExpectationsParserTest, ValidPartialEntry) {
58 const std::string text =
59 "BUG12345 WIN NVIDIA : MyTest = TIMEOUT";
60
61 GPUTestExpectationsParser parser;
62 EXPECT_TRUE(parser.LoadTestExpectations(text));
63 EXPECT_EQ(0u, parser.GetErrorMessages().size());
64 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestTimeout,
65 parser.GetTestExpectation("MyTest", bot_config()));
66 }
67
68 TEST_F(GPUTestExpectationsParserTest, ValidUnrelatedOsEntry) {
69 const std::string text =
70 "BUG12345 LEOPARD : MyTest = TIMEOUT";
71
72 GPUTestExpectationsParser parser;
73 EXPECT_TRUE(parser.LoadTestExpectations(text));
74 EXPECT_EQ(0u, parser.GetErrorMessages().size());
75 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass,
76 parser.GetTestExpectation("MyTest", bot_config()));
77 }
78
79 TEST_F(GPUTestExpectationsParserTest, ValidUnrelatedTestEntry) {
80 const std::string text =
81 "BUG12345 WIN7 RELEASE NVIDIA 0x0640 : AnotherTest = FAIL";
82
83 GPUTestExpectationsParser parser;
84 EXPECT_TRUE(parser.LoadTestExpectations(text));
85 EXPECT_EQ(0u, parser.GetErrorMessages().size());
86 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass,
87 parser.GetTestExpectation("MyTest", bot_config()));
88 }
89
90 TEST_F(GPUTestExpectationsParserTest, AllModifiers) {
91 const std::string text =
92 "BUG12345 XP VISTA WIN7 WIN8 LEOPARD SNOWLEOPARD LION MOUNTAINLION "
93 "LINUX CHROMEOS ANDROID "
94 "NVIDIA INTEL AMD VMWARE RELEASE DEBUG : MyTest = "
95 "PASS FAIL FLAKY TIMEOUT SKIP";
96
97 GPUTestExpectationsParser parser;
98 EXPECT_TRUE(parser.LoadTestExpectations(text));
99 EXPECT_EQ(0u, parser.GetErrorMessages().size());
100 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass |
101 GPUTestExpectationsParser::kGpuTestFail |
102 GPUTestExpectationsParser::kGpuTestFlaky |
103 GPUTestExpectationsParser::kGpuTestTimeout |
104 GPUTestExpectationsParser::kGpuTestSkip,
105 parser.GetTestExpectation("MyTest", bot_config()));
106 }
107
108 TEST_F(GPUTestExpectationsParserTest, DuplicateModifiers) {
109 const std::string text =
110 "BUG12345 WIN7 WIN7 RELEASE NVIDIA 0x0640 : MyTest = FAIL";
111
112 GPUTestExpectationsParser parser;
113 EXPECT_FALSE(parser.LoadTestExpectations(text));
114 EXPECT_NE(0u, parser.GetErrorMessages().size());
115 }
116
117 TEST_F(GPUTestExpectationsParserTest, AllModifiersLowerCase) {
118 const std::string text =
119 "BUG12345 xp vista win7 leopard snowleopard lion linux chromeos android "
120 "nvidia intel amd vmware release debug : MyTest = "
121 "pass fail flaky timeout skip";
122
123 GPUTestExpectationsParser parser;
124 EXPECT_TRUE(parser.LoadTestExpectations(text));
125 EXPECT_EQ(0u, parser.GetErrorMessages().size());
126 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass |
127 GPUTestExpectationsParser::kGpuTestFail |
128 GPUTestExpectationsParser::kGpuTestFlaky |
129 GPUTestExpectationsParser::kGpuTestTimeout |
130 GPUTestExpectationsParser::kGpuTestSkip,
131 parser.GetTestExpectation("MyTest", bot_config()));
132 }
133
134 TEST_F(GPUTestExpectationsParserTest, MissingColon) {
135 const std::string text =
136 "BUG12345 XP MyTest = FAIL";
137
138 GPUTestExpectationsParser parser;
139 EXPECT_FALSE(parser.LoadTestExpectations(text));
140 EXPECT_NE(0u, parser.GetErrorMessages().size());
141 }
142
143 TEST_F(GPUTestExpectationsParserTest, MissingEqual) {
144 const std::string text =
145 "BUG12345 XP : MyTest FAIL";
146
147 GPUTestExpectationsParser parser;
148 EXPECT_FALSE(parser.LoadTestExpectations(text));
149 EXPECT_NE(0u, parser.GetErrorMessages().size());
150 }
151
152 TEST_F(GPUTestExpectationsParserTest, IllegalModifier) {
153 const std::string text =
154 "BUG12345 XP XXX : MyTest = FAIL";
155
156 GPUTestExpectationsParser parser;
157 EXPECT_FALSE(parser.LoadTestExpectations(text));
158 EXPECT_NE(0u, parser.GetErrorMessages().size());
159 }
160
161 TEST_F(GPUTestExpectationsParserTest, OsConflicts) {
162 const std::string text =
163 "BUG12345 XP WIN : MyTest = FAIL";
164
165 GPUTestExpectationsParser parser;
166 EXPECT_FALSE(parser.LoadTestExpectations(text));
167 EXPECT_NE(0u, parser.GetErrorMessages().size());
168 }
169
170 TEST_F(GPUTestExpectationsParserTest, InvalidModifierCombination) {
171 const std::string text =
172 "BUG12345 XP NVIDIA INTEL 0x0640 : MyTest = FAIL";
173
174 GPUTestExpectationsParser parser;
175 EXPECT_FALSE(parser.LoadTestExpectations(text));
176 EXPECT_NE(0u, parser.GetErrorMessages().size());
177 }
178
179 TEST_F(GPUTestExpectationsParserTest, BadGpuDeviceID) {
180 const std::string text =
181 "BUG12345 XP NVIDIA 0xU07X : MyTest = FAIL";
182
183 GPUTestExpectationsParser parser;
184 EXPECT_FALSE(parser.LoadTestExpectations(text));
185 EXPECT_NE(0u, parser.GetErrorMessages().size());
186 }
187
188 TEST_F(GPUTestExpectationsParserTest, MoreThanOneGpuDeviceID) {
189 const std::string text =
190 "BUG12345 XP NVIDIA 0x0640 0x0641 : MyTest = FAIL";
191
192 GPUTestExpectationsParser parser;
193 EXPECT_FALSE(parser.LoadTestExpectations(text));
194 EXPECT_NE(0u, parser.GetErrorMessages().size());
195 }
196
197 TEST_F(GPUTestExpectationsParserTest, MultipleEntriesConflicts) {
198 const std::string text =
199 "BUG12345 WIN7 RELEASE NVIDIA 0x0640 : MyTest = FAIL\n"
200 "BUG12345 WIN : MyTest = FAIL";
201
202 GPUTestExpectationsParser parser;
203 EXPECT_FALSE(parser.LoadTestExpectations(text));
204 EXPECT_NE(0u, parser.GetErrorMessages().size());
205 }
206
207 TEST_F(GPUTestExpectationsParserTest, MultipleTests) {
208 const std::string text =
209 "BUG12345 WIN7 RELEASE NVIDIA 0x0640 : MyTest = FAIL\n"
210 "BUG12345 WIN : AnotherTest = FAIL";
211
212 GPUTestExpectationsParser parser;
213 EXPECT_TRUE(parser.LoadTestExpectations(text));
214 EXPECT_EQ(0u, parser.GetErrorMessages().size());
215 }
216
217 TEST_F(GPUTestExpectationsParserTest, ValidMultipleEntries) {
218 const std::string text =
219 "BUG12345 WIN7 RELEASE NVIDIA 0x0640 : MyTest = FAIL\n"
220 "BUG12345 LINUX : MyTest = TIMEOUT";
221
222 GPUTestExpectationsParser parser;
223 EXPECT_TRUE(parser.LoadTestExpectations(text));
224 EXPECT_EQ(0u, parser.GetErrorMessages().size());
225 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestFail,
226 parser.GetTestExpectation("MyTest", bot_config()));
227 }
228
229 TEST_F(GPUTestExpectationsParserTest, StarMatching) {
230 const std::string text =
231 "BUG12345 WIN7 RELEASE NVIDIA 0x0640 : MyTest* = FAIL";
232
233 GPUTestExpectationsParser parser;
234 EXPECT_TRUE(parser.LoadTestExpectations(text));
235 EXPECT_EQ(0u, parser.GetErrorMessages().size());
236 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestFail,
237 parser.GetTestExpectation("MyTest0", bot_config()));
238 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass,
239 parser.GetTestExpectation("OtherTest", bot_config()));
240 }
241
242 TEST_F(GPUTestExpectationsParserTest, WebGLTestExpectationsValidation) {
243 GPUTestExpectationsParser parser;
244 EXPECT_TRUE(parser.LoadTestExpectations(
245 GPUTestExpectationsParser::kWebGLConformanceTest));
246 EXPECT_EQ(0u, parser.GetErrorMessages().size());
247 for (size_t i = 0; i < parser.GetErrorMessages().size(); ++i)
248 LOG(ERROR) << parser.GetErrorMessages()[i];
249 }
250
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_test_expectations_parser.cc ('k') | gpu/config/gpu_test_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698