aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-29 23:19:32 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-29 23:19:32 +0000
commit2055160694846aa88d2012a77d85c6310f360074 (patch)
tree9ba22269dfd6422708ee3a516d5749087a161e58
parent87ba667717a17773c1f9590a7369f86560e2ee61 (diff)
downloadpaludis-2055160694846aa88d2012a77d85c6310f360074.tar.gz
paludis-2055160694846aa88d2012a77d85c6310f360074.tar.xz
r3664@snowflake: ciaranm | 2007-06-30 00:17:46 +0100
Show execution times for tests
-rw-r--r--test/test_framework.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/test_framework.cc b/test/test_framework.cc
index 03d5149..8154cc6 100644
--- a/test/test_framework.cc
+++ b/test/test_framework.cc
@@ -24,6 +24,7 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <unistd.h>
+#include <sys/time.h>
/** \file
* Implementation for test framework classes.
@@ -253,6 +254,9 @@ RunTest::operator() (TestCase * test_case) const
if (0 != repeat)
std::cout << " (repeat): " << std::flush;
+ struct timeval start_tv;
+ ::gettimeofday(&start_tv, 0);
+
try
{
if (TestCaseList::use_alarm)
@@ -278,7 +282,12 @@ RunTest::operator() (TestCase * test_case) const
if (had_local_failure)
std::cout << " NOT OK";
else
- std::cout << " OK";
+ {
+ struct timeval tv;
+ ::gettimeofday(&tv, 0);
+ const unsigned long delta(((tv.tv_sec - start_tv.tv_sec) * 1000) + ((tv.tv_usec - start_tv.tv_usec) / 1000));
+ std::cout << " OK (" << delta << "ms)";
+ }
std::cout << std::endl;