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

fix copy SingeleServer, more clean up


diffs (237 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -660,6 +660,7 @@ def PerformDir(env, testdir, testlist, B
                 return td, FdErr, interrupted
             z.close()
             if not oneserver:
+                #ServerClass(cmd, TestOut, TestErr, TimeOut, pollfile, port)
                 pSrvr = ServerClass(splitcommand(env['exe']['mserver5'][1]) + 
['--dbpath=%s' % LogDBdir], open(os.devnull, 'w'), open(os.devnull, 'w'), 
par['TIMEOUT'], os.path.join(LogDBdir, '.started'), int(env['MAPIPORT']))
                 pSrvr.LaunchIt()
                 pSrvr.terminate()
@@ -1049,38 +1050,6 @@ def CheckTests(env, TST, oktests):
     return missing
 ### CheckTests(env, TST, oktests) #
 
-def StableOutErr(env,par,TST,SYST,RELEASE,DIST,VERSION) :
-    BITS = env['TST_BITS']
-    INT128 = env['TST_INT128']
-    if INT128:
-        INT128 = r"(\.int128)?"
-    SINGLE = env['TST_SINGLE']
-    if SINGLE:
-        SINGLE = r"(\.single)?"
-    ARCH = env['TST_ARCH']
-    dir,file = os.path.split(TST)
-    outre = 
re.compile(r'^%s\.stable\.(?P<tp>out|err)(\.(%s(%s)?|%s(%s)?))?(\.(%s|%s))?%s%s$'
 % (re.escape(file), re.escape(SYST), re.escape(RELEASE), re.escape(DIST), 
re.escape(VERSION), BITS, ARCH, INT128, SINGLE))
-    bestout = besterr = ''
-    for f in listdir(dir or os.curdir):
-        res = outre.match(f)
-        if res is not None:
-            if res.group('tp') == 'out':
-                if len(bestout) < len(f):
-                    bestout = f
-            else:                   # res.group('tp') == 'err'
-                if len(besterr) < len(f):
-                    besterr = f
-    if bestout:
-        STABLEout = os.path.join(dir, bestout)[len(TST):]
-    else:
-        STABLEout = '.stable.out'
-    if besterr:
-        STABLEerr = os.path.join(dir, besterr)[len(TST):]
-    else:
-        STABLEerr = '.stable.err'
-    return STABLEout, STABLEerr
-### StableOutErr(env,par,TST,SYST,RELEASE,DIST,VERSION) #
-
 relcond = {
     # upgrade testing conditionals:
     # key is condition, value is tuple with file name and part of message
@@ -1669,15 +1638,15 @@ def killProc(proc, outfile = None, cmd =
         killchildren(proc.pid)
 
 class ServerClass:
-    def __init__(self, cmd, TestOut, TestErr, TimeOut, pollfile, port):
+    def __init__(self, cmd, outfile, errfile, timeout, pollfile, port):
         self.proc = None
         self.timer = None
-        self.outfile = TestOut
-        self.errfile = TestErr
+        self.outfile = outfile 
+        self.errfile = errfile
         self.code = None
         self.started = False
         self.cmd = cmd
-        self.timeout = TimeOut
+        self.timeout = timeout
         self.pollfile = pollfile
         self.port = port
 
@@ -1767,8 +1736,7 @@ class ServerClass:
             t.cancel()
             return
         self.started = True
-
-### LaunchIt(cmd, TestIn, TestOut, TestErr, TimeOut, pollfile, port) #
+#ServerClass(cmd, outfile, errfile, timeout, pollfile, port)
 
 def RunIt(cmd, onechild, TestIn, TestOut, TestErr, TimeOut) :
     global setpgrp
@@ -1945,7 +1913,7 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
             if os.path.isfile(TST + '.options5'):
                 Srvr.extend(openutf8(TST + '.options5').read().split())
             lang=""
-
+            
             if SERVER == "MAL":
                 lang="mal"
             if SERVER == "SQL":
@@ -1990,6 +1958,7 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
                     os.makedirs(os.path.join(env['GDK_DBFARM'], TSTPREF + 
'_transient'))
                 elif env.get('TRANS_INMEM'):
                     Srvr.append('--dbextra=:inmemory')
+                #ServerClass(cmd, outfile, errfile, timeout, pollfile, port)
                 pSrvr = ServerClass(Srvr, SrvrOut, SrvrErr, TIMEOUT, 
os.path.join(dbpath, '.started'), int(env['MAPIPORT']))
                 pSrvr.LaunchIt()
             if savepath is not None:
@@ -3063,71 +3032,70 @@ def main(argv) :
 
         BusyPorts = []
 
-        if THISFILE == "Mtest.py":
-            if not env.get('NOCLEAN') and 
os.path.exists(os.path.join(TSTTRGBASE, TSTPREF)):
-                try:
-                    shutil.rmtree(os.path.join(TSTTRGBASE, TSTPREF))
-                except:
-                    ErrXit("Failed to remove %s" % os.path.join(TSTTRGBASE, 
TSTPREF))
-            if not os.path.exists(env['GDK_DBFARM']):
-                #TODO: set mode to umask
-                os.makedirs(env['GDK_DBFARM'])
+        if not env.get('NOCLEAN') and os.path.exists(os.path.join(TSTTRGBASE, 
TSTPREF)):
+            try:
+                shutil.rmtree(os.path.join(TSTTRGBASE, TSTPREF))
+            except:
+                ErrXit("Failed to remove %s" % os.path.join(TSTTRGBASE, 
TSTPREF))
+        if not os.path.exists(env['GDK_DBFARM']):
+            #TODO: set mode to umask
+            os.makedirs(env['GDK_DBFARM'])
 
-            if not env.get('NOCLEAN') and 
os.path.exists(os.path.join(env['GDK_DBFARM'], TSTPREF)):
-                try:
-                    shutil.rmtree(os.path.join(env['GDK_DBFARM'], TSTPREF))
-                except:
-                    ErrXit("Failed to remove %s" % 
os.path.join(env['GDK_DBFARM'], TSTPREF))
+        if not env.get('NOCLEAN') and 
os.path.exists(os.path.join(env['GDK_DBFARM'], TSTPREF)):
             try:
-                os.makedirs(os.path.join(env['GDK_DBFARM'], TSTPREF))
-            except os.error:
-                if not env.get('NOCLEAN'):
-                    ErrXit("Failed to create %s" % 
os.path.join(env['GDK_DBFARM'], TSTPREF))
+                shutil.rmtree(os.path.join(env['GDK_DBFARM'], TSTPREF))
+            except:
+                ErrXit("Failed to remove %s" % os.path.join(env['GDK_DBFARM'], 
TSTPREF))
+        try:
+            os.makedirs(os.path.join(env['GDK_DBFARM'], TSTPREF))
+        except os.error:
+            if not env.get('NOCLEAN'):
+                ErrXit("Failed to create %s" % os.path.join(env['GDK_DBFARM'], 
TSTPREF))
 
-            try:
-                os.makedirs(os.path.join(TSTTRGBASE, TSTPREF))
-            except os.error:
-                if not env.get('NOCLEAN'):
-                    ErrXit("Failed to create %s" % os.path.join(TSTTRGBASE, 
TSTPREF))
+        try:
+            os.makedirs(os.path.join(TSTTRGBASE, TSTPREF))
+        except os.error:
+            if not env.get('NOCLEAN'):
+                ErrXit("Failed to create %s" % os.path.join(TSTTRGBASE, 
TSTPREF))
 
-            # write .monetdb file for mclient to do authentication with
-            dotmonetdbfile = os.path.join(TSTTRGBASE, ".monetdb")
-            dotmonetdb = openutf8(dotmonetdbfile, 'w')
-            dotmonetdb.write('user=monetdb\n')
-            dotmonetdb.write('password=monetdb\n')
-            dotmonetdb.close()
-            # and make mclient find it
-            os.environ['DOTMONETDBFILE'] = dotmonetdbfile
+        # write .monetdb file for mclient to do authentication with
+        dotmonetdbfile = os.path.join(TSTTRGBASE, ".monetdb")
+        dotmonetdb = openutf8(dotmonetdbfile, 'w')
+        dotmonetdb.write('user=monetdb\n')
+        dotmonetdb.write('password=monetdb\n')
+        dotmonetdb.close()
+        # and make mclient find it
+        os.environ['DOTMONETDBFILE'] = dotmonetdbfile
 
-            env['TST_MODS'] = []
-            env['TST_BITS'] = ""
-            env['TST_INT128'] = ""
-            env['TST_SINGLE'] = ""
-            env['TST_THREADS'] = ""
-            env['TST_ARCH'] = ""
-            if GetBitsAndModsAndThreads(env):
-                sys.exit(1)
-            STDERR.flush()
-            if verbose:
-                print("Bits: " + env['TST_BITS'])
-                print("Arch: " + env['TST_ARCH'])
-                if env['TST_INT128']:
-                    print("Integers: 128bit")
-                print("Modules: " + str(env['TST_MODS']))
-            STDOUT.flush()
+        env['TST_MODS'] = []
+        env['TST_BITS'] = ""
+        env['TST_INT128'] = ""
+        env['TST_SINGLE'] = ""
+        env['TST_THREADS'] = ""
+        env['TST_ARCH'] = ""
+        if GetBitsAndModsAndThreads(env):
+            sys.exit(1)
+        STDERR.flush()
+        if verbose:
+            print("Bits: " + env['TST_BITS'])
+            print("Arch: " + env['TST_ARCH'])
+            if env['TST_INT128']:
+                print("Integers: 128bit")
+            print("Modules: " + str(env['TST_MODS']))
+        STDOUT.flush()
 
-            port = int(env['MAPIPORT'])
-            busy, host, Serrno, Serrstr, S = CheckPort(port)
-            S[0].close()
-            S[1].close()
-            if busy:
-                Warn("Skipping MAPI tests as MAPIPORT=%s is not available on 
%s (Error #%d: '%s')!" % (env['MAPIPORT'],host,Serrno,Serrstr))
-                BusyPorts.append('MAPI')
+        port = int(env['MAPIPORT'])
+        busy, host, Serrno, Serrstr, S = CheckPort(port)
+        S[0].close()
+        S[1].close()
+        if busy:
+            Warn("Skipping MAPI tests as MAPIPORT=%s is not available on %s 
(Error #%d: '%s')!" % (env['MAPIPORT'],host,Serrno,Serrstr))
+            BusyPorts.append('MAPI')
 
-            env['SYST'] = os.environ['SYST']
-            env['RELEASE'] = os.environ['RELEASE']
-            env['DIST'] = os.environ['DIST']
-            env['VERSION'] = os.environ['VERSION']
+        env['SYST'] = os.environ['SYST']
+        env['RELEASE'] = os.environ['RELEASE']
+        env['DIST'] = os.environ['DIST']
+        env['VERSION'] = os.environ['VERSION']
 
         STDERR.flush()
         t_ = 0
diff --git a/testing/convert_to_sqllogic.sh b/testing/convert_to_sqllogic.sh
--- a/testing/convert_to_sqllogic.sh
+++ b/testing/convert_to_sqllogic.sh
@@ -73,4 +73,7 @@ done;
 if [[ -e ${src}/All ]];then
     cp ${src}/All $dst;
 fi
+if [[ -e ${src}/SingleServer ]];then
+    cp ${src}/SingleServer $dst;
+fi
 echo "Done"
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to