[gnome-doc-utils] [xml2po] Print time taken to run the regression tests



commit b79452065cf1421dba2570578564c2656dacdbc3
Author: Claude Paroz <claude 2xlibre net>
Date:   Sat Oct 3 18:10:08 2009 +0200

    [xml2po] Print time taken to run the regression tests

 xml2po/tests/README  |    5 +++--
 xml2po/tests/test.py |    5 ++++-
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/xml2po/tests/README b/xml2po/tests/README
index 81640fd..ebec8cd 100644
--- a/xml2po/tests/README
+++ b/xml2po/tests/README
@@ -9,8 +9,9 @@ To run, try
   ./test.py 2>/dev/null
 
 (stderr redirection in order to avoid seeing "Warning: image not
-found" messages; there should be NO OUTPUT at all if all tests are
-successful!)
+found" messages)
+If all tests are successful, the ONLY output should be the number of
+tests and the time taken to run the tests!
 
 Simple tests are consisted of four files: original XML file, PO
 Template (untranslated PO file), PO file (translated) and translated
diff --git a/xml2po/tests/test.py b/xml2po/tests/test.py
index 95c74f6..10c1dcb 100755
--- a/xml2po/tests/test.py
+++ b/xml2po/tests/test.py
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-import sys, os
+import sys, os, time
 
 SIMPLETESTS = { 'deep-finals.xml' : {},
                 'deep-nonfinals.xml': {},
@@ -36,6 +36,7 @@ if len(sys.argv) > 1:
     if ret:
         print "Problem: merging translation into '%s'" % (input)
 else:
+    time_start = time.time()
     for t in SIMPLETESTS:
         myopts = SIMPLETESTS[t].get("options", "")
         if os.system("%s %s %s" % (sys.argv[0], t, myopts)):
@@ -44,4 +45,6 @@ else:
     for t in OTHERTESTS:
         if os.system("cd %s && ./%s" % (t[0], t[1])):
             print "WARNING: Test %s failed." % (t[0])
+    time_end = time.time()
+    print "%d tests executed in %2.2f secs" % (len(SIMPLETESTS)+len(OTHERTESTS), time_end-time_start)
     



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