skia2/dm/DMReporter.cpp
commit-bot@chromium.org 261c666682 Make tests output spin on the same line by default.
-v now gives a cleaned-up version of the existing output (every test timed, useless information removed)

Example output, default:
  [ 36/193] PathOpsCubicIntersectionOneOffTest
then later when finished...
  [193/193] BlurMaskFilter

Example output, -v:  (note, codereview is messing up my pretty spacing)
Skia UnitTests: --resourcePath resources SK_RELEASE SK_SCALAR_IS_FLOAT skia_arch_width=32
[  1/193]     0ms PathOpsSimplifyDontFailOneTest
[  2/193]     0ms PathOpsSimplifyFailOneTest
[  3/193]    30ms PathOpsSkpTest
[  4/193]    21ms PathOpsSimplifyFailTest
....
[182/193]  1026ms BlitRow
[183/193]   808ms AAClip
[184/193]  4333ms Math
[185/193]  5068ms PackBits
[186/193]  2265ms DrawText_DrawPosText
[187/193]  9163ms PathOpsRectsThreadedTest
[188/193]  5540ms GLPrograms
[189/193]     0ms GLInterfaceValidation
[190/193]     2ms DeferredCanvas
[191/193]     1ms ClipCache
[192/193]    30ms BlurMaskFilter
[193/193] 10396ms PathOpsOpCubicsThreadedTest
Finished 193 tests, 0 failures, 0 skipped.  (622610 internal tests)

BUG=
R=halcanary@google.com, mtklein@google.com, bungeman@google.com

Author: mtklein@google.com

Review URL: https://codereview.chromium.org/109513002

git-svn-id: http://skia.googlecode.com/svn/trunk@12860 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-02 16:19:53 +00:00

40 lines
890 B
C++

#include "DMReporter.h"
#include "SkCommandLineFlags.h"
#include "OverwriteLine.h"
DEFINE_bool(quiet, false, "If true, don't print status updates.");
namespace DM {
void Reporter::updateStatusLine() const {
if (FLAGS_quiet) {
return;
}
SkString status;
status.printf("%s%d tasks left", kSkOverwriteLine, this->started() - this->finished());
const int failed = this->failed();
if (failed > 0) {
status.appendf(", %d failed", failed);
}
SkDebugf(status.c_str());
}
int32_t Reporter::failed() const {
SkAutoMutexAcquire reader(&fMutex);
return fFailures.count();
}
void Reporter::fail(SkString name) {
SkAutoMutexAcquire writer(&fMutex);
fFailures.push_back(name);
}
void Reporter::getFailures(SkTArray<SkString>* failures) const {
SkAutoMutexAcquire reader(&fMutex);
*failures = fFailures;
}
} // namespace DM