[cig-commits] r13527 - cs/cigma/trunk/tests/system

luis at geodynamics.org luis at geodynamics.org
Tue Dec 9 18:13:23 PST 2008


Author: luis
Date: 2008-12-09 18:13:22 -0800 (Tue, 09 Dec 2008)
New Revision: 13527

Added:
   cs/cigma/trunk/tests/system/runner.py
Log:
Runner for system tests

Added: cs/cigma/trunk/tests/system/runner.py
===================================================================
--- cs/cigma/trunk/tests/system/runner.py	                        (rev 0)
+++ cs/cigma/trunk/tests/system/runner.py	2008-12-10 02:13:22 UTC (rev 13527)
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+def main():
+    """Run all *.sh in *.py files in the current directory"""
+
+    import sys, os
+    from os.path import abspath, dirname, splitext, join
+
+    root = dirname(abspath(__file__))
+    #print os.listdir(root)
+
+    err = 0
+    stream = sys.stdout
+
+    bash = '/bin/bash'
+    python = os.environ.get('PYTHON', 'python')
+
+    tests = [t for t in os.listdir(root)
+                if t != 'runner.py']
+
+    stream.write('\n')
+    
+    for t in tests:
+        base, ext = splitext(t)
+        test = join(root, t)
+        # run test
+        if ext in ('.sh', '.py'):
+            stream.write('Running system test %s: ' % base)
+            stream.flush()
+            if test.endswith('.sh'):
+                #continue
+                err = os.system('%s %s' % (bash, test))
+            elif test.endswith('.py'):
+                continue
+                err = os.system('%s %s' % (python, test))
+        else:
+            continue
+        # report result
+        if err == 0:
+            stream.write('OK\n')
+        else:
+            stream.write('ERROR %d\n' % err)
+            stream.write('\n\n\n')
+            sys.exit(1)
+
+    return
+
+
+if __name__ == '__main__':
+    main()
+
+


Property changes on: cs/cigma/trunk/tests/system/runner.py
___________________________________________________________________
Name: svn:executable
   + *



More information about the CIG-COMMITS mailing list