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

Merge with Mar2025 branch.


diffs (149 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -1258,6 +1258,8 @@ def PerformDir(env, testdir, testlist, t
                     except:
                         pass
                     environ['MAPIPORT'] = pSrvr.port
+                    if pSrvr.usock is not None:
+                        environ['MAPIUSOCK'] = pSrvr.usock
                     SetExecEnv(env['exe'], pSrvr.port, verbosity > 1, environ)
                 if global_timeout and start_time + global_timeout < 
time.time():
                     if not testweb:
@@ -2889,6 +2891,7 @@ class ServerClass:
 
         port = None
         self.port = None
+        self.usock = None
         if self.pollfile:
             while True:
                 proc.poll()
@@ -2917,9 +2920,14 @@ class ServerClass:
                     return
                 time.sleep(0.1)
             with open(os.path.join(os.path.split(self.pollfile)[0], '.conn')) 
as fil:
-                connurl = fil.read()
-            res = mapiportre.search(connurl)
-            port = res.group('port')
+                connurls = fil.readlines()
+            for connurl in connurls:
+                connurl = connurl.strip()
+                res = mapiportre.search(connurl)
+                if res is not None:
+                    port = res.group('port')
+                elif 'monetdb:///' in connurl:
+                    self.usock = connurl
         else:
             loadedseen = False
             endtime = time.time() + 30
@@ -3134,7 +3142,7 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
                                         password=passwd or 'monetdb',
                                         hostname=HOST,
                                         port=int(pSrvr.port),
-                                        database=TSTDB,
+                                        database=TSTDB if pSrvr.usock is None 
else pSrvr.usock,
                                         language='sql',
                                         timeout=TIMEOUT,
                                         alltests=CONDITIONALS['KNOWNFAIL'])
@@ -3169,7 +3177,7 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
                                     password=passwd or 'monetdb',
                                     hostname=HOST,
                                     port=int(pSrvr.port),
-                                    database=TSTDB,
+                                    database=TSTDB if pSrvr.usock is None else 
pSrvr.usock,
                                     language=lang,
                                     timeout=TIMEOUT,
                                     alltests=CONDITIONALS['KNOWNFAIL'])
@@ -3206,6 +3214,8 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
                                 defines.append(f'TSTSRCBASE={TSTSRCBASE}')
                                 defines.append(f'TSTDB={TSTDB}')
                                 defines.append(f'MAPIPORT={pSrvr.port}')
+                                if pSrvr.usock is not None:
+                                    defines.append(f'MAPIUSOCK={pSrvr.usock}')
                             try:
                                 sql.parse(os.path.join(TSTTRGDIR, testfile), 
approve=open(os.path.join(TSTTRGDIR, TST+'.newtest'),'w') if approve else None, 
defines=defines)
                             except KeyboardInterrupt:
@@ -3248,9 +3258,11 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
                 for i in range(len(Clnt)):
                     Clnt[i] = Clnt[i].replace('${PORT}', pSrvr.port)
                 if user:
-                    Clnt.append('-u%s' % user)
+                    Clnt.append(f'-u{user}')
                 if passwd:
-                    Clnt.append('-P%s' % passwd)
+                    Clnt.append(f'-P{passwd}')
+                if pSrvr.usock:
+                    Clnt.append(f'-d{pSrvr.usock}')
                 for f in TSTs:
                     returncode = RunIt(Clnt, True, 
openutf8(os.path.join(TSTTRGDIR, f)), ClntOut, ClntErr, TIMEOUT, pSrvr, 
TSTTRGDIR, environ)
                     if returncode:
@@ -3417,10 +3429,6 @@ def CheckClassPath():
 
 
 def SetExecEnv(exe,port,verbose,environ):
-    if os.name == 'nt':
-        CALL = 'call '
-    else:
-        CALL = ''
     if verbose:
         print(file=sys.stderr, end='', flush=True)
     for v in exe.keys():
@@ -3428,7 +3436,7 @@ def SetExecEnv(exe,port,verbose,environ)
             V = 'MSERVER'
         else:
             V = v.upper()
-        environ[V] = CALL + ' '.join(exe[v]).replace('${PORT}', port)
+        environ[V] = ' '.join(exe[v]).replace('${PORT}', port)
         if verbose:
             print('%s = %s' % (V, environ[V]))
     if verbose:
diff --git a/testing/malmapi.py b/testing/malmapi.py
--- a/testing/malmapi.py
+++ b/testing/malmapi.py
@@ -104,6 +104,12 @@ class Connection(object):
         unix_socket is used if hostname is not defined.
         """
 
+        if database.startswith('monetdb:///'):
+            unix_socket = database[10:]
+            hostname = database = None
+        elif database.startswith('mapi:monetdb:///'):
+            unix_socket = database[15:]
+            hostname = database = None
         if hostname and hostname.startswith('/') and not unix_socket:
             unix_socket = '%s/.s.monetdb.%d' % (hostname, port)
             hostname = None
diff --git a/testing/process.py b/testing/process.py
--- a/testing/process.py
+++ b/testing/process.py
@@ -376,10 +376,13 @@ class client(Popen):
         # if server instance is specified, it provides defaults for
         # database name and port
         if server is not None:
-            if port is None:
-                port = server.dbport
-            if dbname is None:
-                dbname = server.dbname
+            if port is None and dbname is None and hasattr(server, 'usock') 
and server.usock is not None:
+                dbname = server.usock
+            else:
+                if port is None:
+                    port = server.dbport
+                if dbname is None:
+                    dbname = server.dbname
 
         if port is not None:
             for i in range(len(cmd)):
@@ -392,7 +395,11 @@ class client(Popen):
                 if port:
                     raise
         if dbname is None:
-            dbname = os.getenv('TSTDB')
+            usock = os.getenv('MAPIUSOCK')
+            if usock is None:
+                dbname = os.getenv('TSTDB')
+            else:
+                dbname = usock
         if dbname is not None and dbname:
             cmd.append('--database=%s' % dbname)
         if user is not None or passwd is not None:
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to