Changeset: 6cc764636f7f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6cc764636f7f
Modified Files:
        testing/Mtest.py.in
Branch: Aug2024
Log Message:

Simplify exe "structure".


diffs (147 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -1272,7 +1272,7 @@ def PerformDir(env, testdir, testlist, t
                 else:
                     vaultopt = []
                 if not oneserver:
-                    pSrvr = ServerClass(env['exe']['mserver5'][1] + 
[f'--dbpath={LogDBdir}'] + vaultopt + mserver5_opts, open(os.devnull, 'w'), 
open(os.devnull, 'w'), par['TIMEOUT'], os.path.join(LogDBdir, '.started'), 
TSTDB, dbg=env.get('DBG'))
+                    pSrvr = ServerClass(env['exe']['mserver5'] + 
[f'--dbpath={LogDBdir}'] + vaultopt + mserver5_opts, open(os.devnull, 'w'), 
open(os.devnull, 'w'), par['TIMEOUT'], os.path.join(LogDBdir, '.started'), 
TSTDB, dbg=env.get('DBG'))
                     pSrvr.LaunchIt()
                     pSrvr.terminate()
         if not os.path.exists(TSTTRGDIR):
@@ -1298,12 +1298,12 @@ def PerformDir(env, testdir, testlist, t
                         if o != 'nodrop':
                             opts.append(o)
                     if inmem:
-                        cmd = env['exe']['mserver5'][1] + ['--set', 
f'gdk_dbname={TSTDB}', '--in-memory'] + mserver5_opts + opts
+                        cmd = env['exe']['mserver5'] + ['--set', 
f'gdk_dbname={TSTDB}', '--in-memory'] + mserver5_opts + opts
                         pollfile = None
                         cmd.append('--set')
                         cmd.append(f'gdk_dbtrace={os.path.join(LogDBdir, 
"mdbtrace.log")}')
                     else:
-                        cmd = env['exe']['mserver5'][1] + 
[f'--dbpath={LogDBdir}'] + mserver5_opts + opts
+                        cmd = env['exe']['mserver5'] + 
[f'--dbpath={LogDBdir}'] + mserver5_opts + opts
                         pollfile = os.path.join(LogDBdir, '.started')
                     if os.path.exists(keyfile):
                         cmd.extend(['--set', f'monet_vault_key={keyfile}'])
@@ -1637,7 +1637,7 @@ def returnCode(proc, f = None):
 def GetBitsAndModsAndThreads(env) :
     global setpgrp
     rtrn = 0
-    cmd = env['exe']['mserver5'][1].copy()
+    cmd = env['exe']['mserver5'].copy()
     dbpath = os.path.join(env['GDK_DBFARM'], TSTPREF)
     try:
         os.unlink(os.path.join(dbpath, '.started'))
@@ -2041,20 +2041,26 @@ def RunTest(env, TST, COND, oktests, len
     elif MissingTests:
         reason = "as required test%s '%s' failed." % ('s' if len(MissingTests) 
!= 1 else '', "', '".join(MissingTests))
         elem = SkipTest(env, TST, EXT, reason, length)
-    elif EXT == ".sql" and  not env['exe']['SQL_Client'][0]:
-        reason = "as %s is not available." % env['SQLCLIENT'].split(None, 1)[0]
+    elif EXT == ".sql" and 'SQL_Client' not in env['exe']:
+        reason = f"as {env['SQLCLIENT'].split(None, 1)[0]} is not available."
         elem = SkipTest(env, TST, EXT, reason, length)
-    elif EXT == ".sql" and  not env['exe']['SQL_Dump'][0]:
-        reason = "as %s is not available." % env['SQLDUMP'].split(None, 1)[0]
+    elif EXT == ".sql" and 'SQL_Dump' not in env['exe']:
+        reason = f"as {env['SQLDUMP'].split(None, 1)[0]} is not available."
+        elem = SkipTest(env, TST, EXT, reason, length)
+    elif CALL == 'ruby' and 'ruby_client' not in env['exe']:
+        reason = f"as {env['RUBYCLIENT'].split(None, 1)[0]} is not available."
         elem = SkipTest(env, TST, EXT, reason, length)
-    elif SERVER == "SQL" and not env['exe']['mserver5'][0]:
-        reason = "as %s is not available." % env['MSERVER'].split(None, 1)[0]
+    elif CALL == 'R' and 'R_client' not in env['exe']:
+        reason = f"as {env['RCLIENT'].split(None, 1)[0]} is not available."
         elem = SkipTest(env, TST, EXT, reason, length)
-    elif EXT == ".malS" and not env['exe']['mserver5'][0]:
-        reason = "as %s is not available." % env['MSERVER'].split(None, 1)[0]
+    elif SERVER == "SQL" and 'mserver5' not in env['exe']:
+        reason = f"as {env['MSERVER'].split(None, 1)[0]} is not available."
+        elem = SkipTest(env, TST, EXT, reason, length)
+    elif EXT == ".malS" and 'mserver5' not in env['exe']:
+        reason = f"as {env['MSERVER'].split(None, 1)[0]} is not available."
         elem = SkipTest(env, TST, EXT, reason, length)
     elif MissingMods:
-        reason = "as modules '%s` are missing." % str(MissingMods)
+        reason = f"as modules '{MissingMods}` are missing."
         elem = SkipTest(env, TST, EXT, reason, length)
     elif skip_timeout and os.path.isfile(os.path.join(TSTSRCDIR, 
TST+".timeout")):
         reason = "test with timeout"
@@ -2837,7 +2843,7 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
             ClntErr = openutf8(ClntErrFile,"w")
 
             if PSRVR is None:
-                Srvr = exe['mserver5'][1].copy()
+                Srvr = exe['mserver5'].copy()
                 if nomito:
                     try:
                         Srvr.remove('--forcemito')
@@ -2971,7 +2977,7 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
                     if test.match(f):
                         TSTs.append(f)
 
-                Clnt = exe['SQL_Client'][1].copy()
+                Clnt = exe['SQL_Client'].copy()
                 for i in range(len(Clnt)):
                     Clnt[i] = Clnt[i].replace('${PORT}', env['MAPIPORT'])
                 if user:
@@ -2983,12 +2989,12 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
                     if returncode:
                         break
             elif CALL == "R":
-                Clnt = exe['R_Client'][1].copy()
+                Clnt = exe['R_Client'].copy()
                 for i in range(len(Clnt)):
                     Clnt[i] = Clnt[i].replace('${PORT}', env['MAPIPORT'])
                 RunIt(Clnt, False, openutf8(TST+EXT), ClntOut, ClntErr, 
TIMEOUT, pSrvr)
             elif CALL == "ruby":
-                Clnt = exe['ruby_client'][1].copy()
+                Clnt = exe['ruby_client'].copy()
                 for i in range(len(Clnt)):
                     Clnt[i] = Clnt[i].replace('${PORT}', env['MAPIPORT'])
                 Clnt.extend([TST + EXT])
@@ -3161,12 +3167,9 @@ def SetExecEnv(exe,port,verbose) :
             V = 'MSERVER'
         else:
             V = v.upper()
-        if exe[v][0]:
-            os.environ[V] = CALL + ' '.join(exe[v][1]).replace('${PORT}', port)
-        else:
-            os.environ[V] = ""
+        os.environ[V] = CALL + ' '.join(exe[v]).replace('${PORT}', port)
         if verbose:
-            print("%s = %s : %s" % (V, exe[v][0], os.environ[V]))
+            print("%s = %s" % (V, os.environ[V]))
     if verbose:
         print(end='', flush=True)
 ### SetExecEnv(exe,port,procdebug) #
@@ -3841,13 +3844,19 @@ def main(argv) :
             SOCK = ""
 
         exe = {}
-        exe['mserver5']       = CheckExec('mserver5')     , 
splitcommand('mserver5 --debug=%s --debug=256 --set gdk_nr_threads=%s %s --set 
mapi_listenaddr=all --set mapi_port=0 %s %s' % \
-                                                                         
(env['GDK_DEBUG'], env['GDK_NR_THREADS'], env['setMONETDB_MOD_PATH'], SOCK, 
'--forcemito' if not nomito else ''))
-        exe['ruby_client']   = CheckExec(env['RUBYCLIENT'].split(None, 1)[0])  
 , splitcommand('%s %s' % (env['RUBYCLIENT'], '${PORT}'))
-        exe['MAL_Client']    = CheckExec(env['MALCLIENT'].split(None, 1)[0])  
, splitcommand('%s --host=%s --port=%s' % (env['MALCLIENT'], HOST, '${PORT}'))
-        exe['SQL_Client']    = CheckExec(env['SQLCLIENT'].split(None, 1)[0])   
, splitcommand('%s -i -e --host=%s --port=%s' % (env['SQLCLIENT'], HOST, 
'${PORT}'))
-        exe['SQL_Dump']      = CheckExec(env['SQLDUMP'].split(None, 1)[0])     
, splitcommand('%s --host=%s --port=%s' % (env['SQLDUMP'], HOST, '${PORT}'))
-        exe['R_Client']   = CheckExec(env['RCLIENT'].split(None, 1)[0])   , 
splitcommand('%s --args %s' % (env['RCLIENT'], '${PORT}'))
+        if CheckExec('mserver5'):
+            exe['mserver5'] = splitcommand('mserver5 --debug=%s --debug=256 
--set gdk_nr_threads=%s %s --set mapi_listenaddr=all --set mapi_port=0 %s %s' % 
\
+                                           (env['GDK_DEBUG'], 
env['GDK_NR_THREADS'], env['setMONETDB_MOD_PATH'], SOCK, '--forcemito' if not 
nomito else ''))
+        if CheckExec(env['RUBYCLIENT'].split(None, 1)[0]):
+            exe['ruby_client'] = splitcommand('%s %s' % (env['RUBYCLIENT'], 
'${PORT}'))
+        if CheckExec(env['MALCLIENT'].split(None, 1)[0]):
+            exe['MAL_Client'] = splitcommand('%s --host=%s --port=%s' % 
(env['MALCLIENT'], HOST, '${PORT}'))
+        if CheckExec(env['SQLCLIENT'].split(None, 1)[0]):
+            exe['SQL_Client'] = splitcommand('%s -i -e --host=%s --port=%s' % 
(env['SQLCLIENT'], HOST, '${PORT}'))
+        if CheckExec(env['SQLDUMP'].split(None, 1)[0]):
+            exe['SQL_Dump'] = splitcommand('%s --host=%s --port=%s' % 
(env['SQLDUMP'], HOST, '${PORT}'))
+        if CheckExec(env['RCLIENT'].split(None, 1)[0]):
+            exe['R_Client'] = splitcommand('%s --args %s' % (env['RCLIENT'], 
'${PORT}'))
         env['exe'] = exe
 
         # parse commandline arguments
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to