From b4cf44b03c389989ea9904fbd9256781de72d166 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 7 Oct 2015 20:45:05 +0000 Subject: [PATCH] Add timing data to test output Print individual and aggregate functional test durations. --- bin/test | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/test b/bin/test index 925e558..1f5f91f 100755 --- a/bin/test +++ b/bin/test @@ -7,6 +7,7 @@ import sys import telnetlib +import time test_account0_setup = ( (0, "Identify yourself:", "luser0"), @@ -135,10 +136,12 @@ dialogue = ( captures = ["", ""] lusers = [telnetlib.Telnet(), telnetlib.Telnet()] success = True +start = time.time() for luser in lusers: luser.open("::1", 6669) for test, description in dialogue: print("\nTesting %s..." % description) + test_start = time.time() for conversant, question, answer in test: print("luser%s waiting for: %s" % (conversant, question)) index, match, received = lusers[conversant].expect( @@ -160,6 +163,9 @@ for test, description in dialogue: captures[conversant] += "%s\r\n" % answer if not success: break + print("Completed in %.3f seconds." % (time.time() - test_start)) +duration = time.time() - start +print("") for conversant in range(len(captures)): try: captures[conversant] += lusers[ @@ -170,5 +176,9 @@ for conversant in range(len(captures)): log = open("capture_%s.log" % conversant, "w") log.write(captures[conversant]) log.close() -if not success: +print("\nRan %s tests in %.3f seconds." % (len(dialogue), duration)) +if success: + print("SUCCESS") +else: + print("FAILURE") sys.exit(1) -- 2.11.0