summaryrefslogtreecommitdiffstats
path: root/src/ninja_test.cc
diff options
context:
space:
mode:
authorScott Graham <scottmg@chromium.org>2013-04-18 00:30:06 (GMT)
committerScott Graham <scottmg@chromium.org>2013-04-18 00:30:06 (GMT)
commit9e0443bee9c9d21f795f95f4585d578e26336dad (patch)
treeaf0fdf3182c6814cc1e13d2d1e9918fa0541061b /src/ninja_test.cc
parentbce105ead963eef8822e4b7a38e9e46ec8d06d2b (diff)
downloadNinja-9e0443bee9c9d21f795f95f4585d578e26336dad.zip
Ninja-9e0443bee9c9d21f795f95f4585d578e26336dad.tar.gz
Ninja-9e0443bee9c9d21f795f95f4585d578e26336dad.tar.bz2
also print iteration for gtest_repeat=-1
Diffstat (limited to 'src/ninja_test.cc')
-rw-r--r--src/ninja_test.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/ninja_test.cc b/src/ninja_test.cc
index b772441..f091cc8 100644
--- a/src/ninja_test.cc
+++ b/src/ninja_test.cc
@@ -33,7 +33,7 @@ std::string StringPrintf(const char* format, ...) {
/// A test result printer that's less wordy than gtest's default.
class LaconicPrinter : public testing::EmptyTestEventListener {
public:
- LaconicPrinter() : tests_started_(0), test_count_(0) {}
+ LaconicPrinter() : tests_started_(0), test_count_(0), iteration_(0) {}
virtual void OnTestProgramStart(const testing::UnitTest& unit_test) {
test_count_ = unit_test.test_to_run_count();
}
@@ -41,13 +41,20 @@ class LaconicPrinter : public testing::EmptyTestEventListener {
virtual void OnTestIterationStart(const testing::UnitTest& test_info,
int iteration) {
tests_started_ = 0;
+ iteration_ = iteration;
}
virtual void OnTestStart(const testing::TestInfo& test_info) {
++tests_started_;
- printer_.Print(StringPrintf("[%d/%d] %s.%s", tests_started_, test_count_,
- test_info.test_case_name(), test_info.name()),
- LinePrinter::ELIDE);
+ printer_.Print(
+ StringPrintf("[%d/%d%s] %s.%s",
+ tests_started_,
+ test_count_,
+ iteration_ ? StringPrintf(" iter %d", iteration_).c_str()
+ : "",
+ test_info.test_case_name(),
+ test_info.name()),
+ LinePrinter::ELIDE);
}
virtual void OnTestPartResult(
@@ -67,6 +74,7 @@ class LaconicPrinter : public testing::EmptyTestEventListener {
LinePrinter printer_;
int tests_started_;
int test_count_;
+ int iteration_;
};
int main(int argc, char **argv) {