Add timing data to test output
[mudpy.git] / bin / test
index 925e558..1f5f91f 100755 (executable)
--- 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)