Changeset: f811a1ea02bf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f811a1ea02bf
Modified Files:
        testing/Mconvert.py.in
Branch: mtest
Log Message:

auto mode in Mconvert


diffs (55 lines):

diff --git a/testing/Mconvert.py.in b/testing/Mconvert.py.in
--- a/testing/Mconvert.py.in
+++ b/testing/Mconvert.py.in
@@ -542,7 +542,7 @@ def find_test_dirs(thisdir) :
     return testdirs
 ### find_test_dirs(thisdir) #
 
-def PerformDir(env, testdir) :
+def PerformDir(env, testdir, auto=False) :
     oneserver = testdir.get('single_server', False)
     options = testdir.get('server_options', [])
     testlist = testdir.get('tests', [])
@@ -645,11 +645,19 @@ def PerformDir(env, testdir) :
             with open('/tmp/sqllogic.in', 'r') as fin:
                 cmd = ['mktest.py', '--database', TSTDB, '--port', 
str(pSrvr.port), '--language', CALL]
                 with process.Popen(cmd, stdin=fin, stdout=process.PIPE, 
text=True) as proc:
-                    print(proc.stdout.read())
-                    if len(fix.keys()) > 0:
-                        print('-- WARNING expanded variables needs to be 
converted back')
-                        for k in fix:
-                            print('--', key,':', fix[key])
+                    if auto:
+                        with open(t.get('test_path') + '.test', 'w') as fout:
+                            print(proc.stdout.read(), file=fout)
+                            if len(fix.keys()) > 0:
+                                print('-- WARNING expanded variables needs to 
be converted back', file=fout)
+                                for k in fix:
+                                    print('--', key,':', fix[key], file=fout)
+                    else:
+                        print(proc.stdout.read())
+                        if len(fix.keys()) > 0:
+                            print('-- WARNING expanded variables needs to be 
converted back')
+                            for k in fix:
+                                print('--', key,':', fix[key])
         finally:
             if pSrvr is not None:
                 pSrvr.terminate()
@@ -2386,6 +2394,8 @@ def main(argv) :
     parser.add_argument('--initdb', action='store', dest='initdb', 
metavar='<zipfile>', help='zip file with contents for initial database')
 
     parser.add_argument('tests', nargs='*', help='The positional arguments are 
either a list of one or more directories to be tested, or a single directory 
followed by a list of tests within that directory.')
+    parser.add_argument('--auto', action='store_true', help='auto mode wher 
for each test converted a .test file is created')
+
     opts = parser.parse_args()
     args = opts.tests
 
@@ -2787,7 +2797,7 @@ def main(argv) :
         if len(folders) == 0:
             raise SystemExit('ERROR: no valid test folder')
 
-        PerformDir(env, folders.pop())
+        PerformDir(env, folders.pop(), auto=opts.auto)
 
     except Exception as e:
         raise SystemExit(e)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to