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

Side by Side Diff: dm/DMReporter.cpp

Issue 178273002: Let DM run unit tests. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 10 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 | « dm/DMReporter.h ('k') | dm/DMTask.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "DMReporter.h" 1 #include "DMReporter.h"
2 2
3 #include "SkCommandLineFlags.h" 3 #include "SkCommandLineFlags.h"
4 #include "OverwriteLine.h" 4 #include "OverwriteLine.h"
5 5
6 DEFINE_bool(quiet, false, "If true, don't print status updates."); 6 DEFINE_bool2(quiet, q, false, "If true, don't print status updates.");
7 DEFINE_bool2(verbose, v, false, "If true, print status updates one-per-line.");
7 8
8 namespace DM { 9 namespace DM {
9 10
10 void Reporter::updateStatusLine() const { 11 void Reporter::finish(SkString name) {
12 sk_atomic_inc(&fFinished);
13
11 if (FLAGS_quiet) { 14 if (FLAGS_quiet) {
12 return; 15 return;
13 } 16 }
14 17
15 SkString status; 18 SkString status;
16 status.printf("%s%d tasks left", kSkOverwriteLine, this->started() - this->f inished()); 19 status.printf("%s%d tasks left",
20 FLAGS_verbose ? "\n" : kSkOverwriteLine,
21 this->started() - this->finished());
17 const int failed = this->failed(); 22 const int failed = this->failed();
18 if (failed > 0) { 23 if (failed > 0) {
19 status.appendf(", %d failed", failed); 24 status.appendf(", %d failed", failed);
20 } 25 }
26 status.appendf("\t[%s done]", name.c_str());
21 SkDebugf(status.c_str()); 27 SkDebugf(status.c_str());
22 } 28 }
23 29
24 int32_t Reporter::failed() const { 30 int32_t Reporter::failed() const {
25 SkAutoMutexAcquire reader(&fMutex); 31 SkAutoMutexAcquire reader(&fMutex);
26 return fFailures.count(); 32 return fFailures.count();
27 } 33 }
28 34
29 void Reporter::fail(SkString name) { 35 void Reporter::fail(SkString msg) {
30 SkAutoMutexAcquire writer(&fMutex); 36 SkAutoMutexAcquire writer(&fMutex);
31 fFailures.push_back(name); 37 fFailures.push_back(msg);
32 } 38 }
33 39
34 void Reporter::getFailures(SkTArray<SkString>* failures) const { 40 void Reporter::getFailures(SkTArray<SkString>* failures) const {
35 SkAutoMutexAcquire reader(&fMutex); 41 SkAutoMutexAcquire reader(&fMutex);
36 *failures = fFailures; 42 *failures = fFailures;
37 } 43 }
38 44
39 } // namespace DM 45 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMReporter.h ('k') | dm/DMTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698