[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Measuring test duration?

From: Dan Kegel
Subject: Measuring test duration?
Date: Tue, 11 Sep 2012 15:32:54 -0700

Hi all,
I'm running a test suite on an underpowered machine, and want to
have test results automatically annotated with how long each one took.
Some of our tests are gtest based, and those already do what I want, e.g.

[       OK ] RecentServerOnly.FailedPermissionize (43 ms)

A quick hack to my did something similar for simple
automake-generated tests, e.g.

PASS: [0:00.11]

Here's the hack; it would go into lib/am/ if it were worth submitting:

--- Makefile    2012-09-11 15:31:07.000000000 -0700
+++ Makefile.hacked     2012-09-11 15:30:30.000000000 -0700
@@ -1093,7 +1093,7 @@
            if test -f ./$$tst; then dir=./; \
            elif test -f $$tst; then dir=; \
            else dir="$(srcdir)/"; fi; \
-           if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+           if time -f "%E" -o /tmp/time.out env $(TESTS_ENVIRONMENT)
$${dir}$$tst; then \
              all=`expr $$all + 1`; \
              case " $(XFAIL_TESTS) " in \
              *[\ \     ]$$tst[\ \      ]*) \
@@ -1121,7 +1121,7 @@
              skip=`expr $$skip + 1`; \
              col=$$blu; res=SKIP; \
            fi; \
-           echo "$${col}$$res$${std}: $$tst"; \
+           echo "$${col}$$res$${std}: $$tst [`cat /tmp/time.out`]"; \
          done; \
          if test "$$all" -eq 1; then \
            tests="test"; \

But this hack isn't really ready for prime time, since (a) its use of time
is probably nonportable, and (b) trying to quit the tests with ^C is
a lot harder with the hack for some reason.

I'll probably live with the hack for now, but it'd be nice to have something
like this integrated into automake.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]