[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Include milliseconds in test report

From: Branko Cibej <brane_at_xbc.nu>
Date: Mon, 26 Oct 2009 11:38:53 +0100

Bhuvaneswaran A wrote:
> As discussed in this email thread [1], please find attached the patch to
> include milliseconds in the time taken to execute each test.
>
> [[
> While running the test suite, even the milliseconds are accountable.
>
> * build/run_tests.py
> (_run_test): Include milliseconds while printing the time taken to
> execute each test.
> ]]

"As discussed", yes; but I don't believe this will account for the
discrepancy between wall clock time and reported test execution time,
also "as discussed". :)

> Index: build/run_tests.py
> =======================================
> --- build/run_tests.py (revision 40220)
> +++ build/run_tests.py (working copy)
> @@ -270,8 +270,14 @@
> log.write('FAIL: %s: Unknown test failure.\n' % progbase)
> # Log the elapsed time.
> - elapsed_time = time.strftime('%H:%M:%S',
> - time.gmtime(time.time() - start_time))
> + test_time = time.time() - start_time
> + elapsed_time = time.strftime('%H:%M:%S', time.gmtime(test_time))
> +
> + # certain system clock may not provide fractions of second
> + if str(test_time).find('.') == -1:
> + elapsed_time += '.00'
> + else:
> + elapsed_time += '.' + str(test_time).split('.')[1]
> log.write('END: %s\n' % progbase)
> log.write('ELAPSED: %s %s\n' % (progbase, elapsed_time))
> log.write('\n')

Uh. Why don't you just format in the milliseconds in strftime? The
Python documentation is your friend. Who cares if the system clock isn't
precise enough -- you'll just get the zeros there from strftime instead.
(And note that you need three digits, not two, to correctly represent
milliseconds.)

-- Brane

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2411332
Received on 2009-10-26 11:39:13 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.