Changeset: 1bca6be19766 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1bca6be19766
Modified Files:
        testing/Mtest.py.in
Branch: Jul2015
Log Message:

Added --addreqs option to automatically add required tests.
When you want to run Mtest for a single test, but that tests depends
on a bunch of other tests, it can be hard to figure out which ones to
run.  This task is now automated.


diffs (52 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -3527,6 +3527,8 @@ def main(argv) :
              'Do not pass --forcemito to server'),
             ('jenkins', None, 'jenkins', None,
              'special handling for Jenkins'),
+            ('addreqs', None, 'addreqs', None,
+             'automatically add required tests when testing individual tests'),
             ]
 
     if THISFILE == 'Mtest.py':
@@ -3607,6 +3609,7 @@ def main(argv) :
     nomito = opts.get('nomito', False)
     CONDITIONALS['RELEASERUN'] = releaserun
     jenkins = False
+    addreqs = False
     if THISFILE == "Mtest.py":
         _IGNORE = dftIGNORE
         par['IGNORE'] = opts.get('ignore', _IGNORE)
@@ -3649,6 +3652,7 @@ def main(argv) :
         if a is not None:
             env['MULTIFARM'] = 'True'
         jenkins = opts.get('jenkins', False)
+        addreqs = opts.get('addreqs', False)
     if THISFILE == 'Mapprove.py':
         a = opts.get('ext')
         if a is None:
@@ -4004,6 +4008,23 @@ def main(argv) :
             Warn("No tests found in %s!" % ', '.join(dirlist))
             sys.exit(1)
 
+        if len(testdirs) == 1 and len(testlist) > 0 and addreqs:
+            added = True
+            while added:
+                added = False
+                i = 0
+                while i < len(testlist):
+                    if os.path.exists(os.path.join(testdirs[0], 'Tests', 
testlist[i] + '.reqtests')):
+                        for t in open(os.path.join(testdirs[0], 'Tests', 
testlist[i] + '.reqtests')):
+                            t = t[:-1] # remove newline
+                            if t not in testlist[:i]:
+                                testlist.insert(i, t)
+                                i = i + 1
+                                added = True
+                            #elif t in testlist:
+                                # WARNING: tests in wrong order
+                    i = i + 1
+
         BusyPorts = []
 
         if THISFILE == "Mtest.py":
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to