OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/test/launcher/test_results_tracker.h" | 5 #include "base/test/launcher/test_results_tracker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 void Add(const TestResult& result) { | 58 void Add(const TestResult& result) { |
59 tests++; | 59 tests++; |
60 elapsed_time += result.elapsed_time; | 60 elapsed_time += result.elapsed_time; |
61 | 61 |
62 switch (result.status) { | 62 switch (result.status) { |
63 case TestResult::TEST_SUCCESS: | 63 case TestResult::TEST_SUCCESS: |
64 break; | 64 break; |
65 case TestResult::TEST_FAILURE: | 65 case TestResult::TEST_FAILURE: |
66 failures++; | 66 failures++; |
67 break; | 67 break; |
| 68 case TestResult::TEST_EXCESSIVE_OUTPUT: |
68 case TestResult::TEST_FAILURE_ON_EXIT: | 69 case TestResult::TEST_FAILURE_ON_EXIT: |
69 case TestResult::TEST_TIMEOUT: | 70 case TestResult::TEST_TIMEOUT: |
70 case TestResult::TEST_CRASH: | 71 case TestResult::TEST_CRASH: |
71 case TestResult::TEST_UNKNOWN: | 72 case TestResult::TEST_UNKNOWN: |
72 errors++; | 73 errors++; |
73 break; | 74 break; |
74 case TestResult::TEST_SKIPPED: | 75 case TestResult::TEST_SKIPPED: |
75 disabled++; | 76 disabled++; |
76 break; | 77 break; |
77 } | 78 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 241 |
241 void TestResultsTracker::PrintSummaryOfCurrentIteration() const { | 242 void TestResultsTracker::PrintSummaryOfCurrentIteration() const { |
242 TestStatusMap tests_by_status(GetTestStatusMapForCurrentIteration()); | 243 TestStatusMap tests_by_status(GetTestStatusMapForCurrentIteration()); |
243 | 244 |
244 PrintTests(tests_by_status[TestResult::TEST_FAILURE].begin(), | 245 PrintTests(tests_by_status[TestResult::TEST_FAILURE].begin(), |
245 tests_by_status[TestResult::TEST_FAILURE].end(), | 246 tests_by_status[TestResult::TEST_FAILURE].end(), |
246 "failed"); | 247 "failed"); |
247 PrintTests(tests_by_status[TestResult::TEST_FAILURE_ON_EXIT].begin(), | 248 PrintTests(tests_by_status[TestResult::TEST_FAILURE_ON_EXIT].begin(), |
248 tests_by_status[TestResult::TEST_FAILURE_ON_EXIT].end(), | 249 tests_by_status[TestResult::TEST_FAILURE_ON_EXIT].end(), |
249 "failed on exit"); | 250 "failed on exit"); |
| 251 PrintTests(tests_by_status[TestResult::TEST_EXCESSIVE_OUTPUT].begin(), |
| 252 tests_by_status[TestResult::TEST_EXCESSIVE_OUTPUT].end(), |
| 253 "produced excessive output"); |
250 PrintTests(tests_by_status[TestResult::TEST_TIMEOUT].begin(), | 254 PrintTests(tests_by_status[TestResult::TEST_TIMEOUT].begin(), |
251 tests_by_status[TestResult::TEST_TIMEOUT].end(), | 255 tests_by_status[TestResult::TEST_TIMEOUT].end(), |
252 "timed out"); | 256 "timed out"); |
253 PrintTests(tests_by_status[TestResult::TEST_CRASH].begin(), | 257 PrintTests(tests_by_status[TestResult::TEST_CRASH].begin(), |
254 tests_by_status[TestResult::TEST_CRASH].end(), | 258 tests_by_status[TestResult::TEST_CRASH].end(), |
255 "crashed"); | 259 "crashed"); |
256 PrintTests(tests_by_status[TestResult::TEST_SKIPPED].begin(), | 260 PrintTests(tests_by_status[TestResult::TEST_SKIPPED].begin(), |
257 tests_by_status[TestResult::TEST_SKIPPED].end(), | 261 tests_by_status[TestResult::TEST_SKIPPED].end(), |
258 "skipped"); | 262 "skipped"); |
259 PrintTests(tests_by_status[TestResult::TEST_UNKNOWN].begin(), | 263 PrintTests(tests_by_status[TestResult::TEST_UNKNOWN].begin(), |
260 tests_by_status[TestResult::TEST_UNKNOWN].end(), | 264 tests_by_status[TestResult::TEST_UNKNOWN].end(), |
261 "had unknown result"); | 265 "had unknown result"); |
262 } | 266 } |
263 | 267 |
264 void TestResultsTracker::PrintSummaryOfAllIterations() const { | 268 void TestResultsTracker::PrintSummaryOfAllIterations() const { |
265 DCHECK(thread_checker_.CalledOnValidThread()); | 269 DCHECK(thread_checker_.CalledOnValidThread()); |
266 | 270 |
267 TestStatusMap tests_by_status(GetTestStatusMapForAllIterations()); | 271 TestStatusMap tests_by_status(GetTestStatusMapForAllIterations()); |
268 | 272 |
269 fprintf(stdout, "Summary of all test iterations:\n"); | 273 fprintf(stdout, "Summary of all test iterations:\n"); |
270 fflush(stdout); | 274 fflush(stdout); |
271 | 275 |
272 PrintTests(tests_by_status[TestResult::TEST_FAILURE].begin(), | 276 PrintTests(tests_by_status[TestResult::TEST_FAILURE].begin(), |
273 tests_by_status[TestResult::TEST_FAILURE].end(), | 277 tests_by_status[TestResult::TEST_FAILURE].end(), |
274 "failed"); | 278 "failed"); |
275 PrintTests(tests_by_status[TestResult::TEST_FAILURE_ON_EXIT].begin(), | 279 PrintTests(tests_by_status[TestResult::TEST_FAILURE_ON_EXIT].begin(), |
276 tests_by_status[TestResult::TEST_FAILURE_ON_EXIT].end(), | 280 tests_by_status[TestResult::TEST_FAILURE_ON_EXIT].end(), |
277 "failed on exit"); | 281 "failed on exit"); |
| 282 PrintTests(tests_by_status[TestResult::TEST_EXCESSIVE_OUTPUT].begin(), |
| 283 tests_by_status[TestResult::TEST_EXCESSIVE_OUTPUT].end(), |
| 284 "produced excessive output"); |
278 PrintTests(tests_by_status[TestResult::TEST_TIMEOUT].begin(), | 285 PrintTests(tests_by_status[TestResult::TEST_TIMEOUT].begin(), |
279 tests_by_status[TestResult::TEST_TIMEOUT].end(), | 286 tests_by_status[TestResult::TEST_TIMEOUT].end(), |
280 "timed out"); | 287 "timed out"); |
281 PrintTests(tests_by_status[TestResult::TEST_CRASH].begin(), | 288 PrintTests(tests_by_status[TestResult::TEST_CRASH].begin(), |
282 tests_by_status[TestResult::TEST_CRASH].end(), | 289 tests_by_status[TestResult::TEST_CRASH].end(), |
283 "crashed"); | 290 "crashed"); |
284 PrintTests(tests_by_status[TestResult::TEST_SKIPPED].begin(), | 291 PrintTests(tests_by_status[TestResult::TEST_SKIPPED].begin(), |
285 tests_by_status[TestResult::TEST_SKIPPED].end(), | 292 tests_by_status[TestResult::TEST_SKIPPED].end(), |
286 "skipped"); | 293 "skipped"); |
287 PrintTests(tests_by_status[TestResult::TEST_UNKNOWN].begin(), | 294 PrintTests(tests_by_status[TestResult::TEST_UNKNOWN].begin(), |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 TestResultsTracker::PerIterationData::PerIterationData() { | 453 TestResultsTracker::PerIterationData::PerIterationData() { |
447 } | 454 } |
448 | 455 |
449 TestResultsTracker::PerIterationData::PerIterationData( | 456 TestResultsTracker::PerIterationData::PerIterationData( |
450 const PerIterationData& other) = default; | 457 const PerIterationData& other) = default; |
451 | 458 |
452 TestResultsTracker::PerIterationData::~PerIterationData() { | 459 TestResultsTracker::PerIterationData::~PerIterationData() { |
453 } | 460 } |
454 | 461 |
455 } // namespace base | 462 } // namespace base |
OLD | NEW |