Changeset: 985ccdc18fbc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=985ccdc18fbc
Modified Files:
testing/Mtest.py.in
Branch: Nov2019
Log Message:
Run single server for complete directory if file "SingleServer" exists.
Watch out: no recovery from server crashes (yet?).
diffs (219 lines):
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -1233,6 +1233,7 @@ def PerformDir(env, testdir, testlist, B
cond,tst = None,tc
alltests.append((tst,cond))
allf.close()
+ oneserver = os.path.exists(os.path.join(TSTSRCDIR, "SingleServer"))
if testlist:
tl = []
@@ -1320,9 +1321,10 @@ def PerformDir(env, testdir, testlist, B
# add "something" to HTML output
return td, elem, max(FdOut, FdErr), interrupted
z.close()
- pSrvr = ServerClass()
- pSrvr.LaunchIt(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.terminate()
+ if not oneserver:
+ pSrvr = ServerClass()
+ pSrvr.LaunchIt(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.terminate()
if not os.path.exists(TSTTRGDIR):
#TODO: set mode to umask
os.makedirs(TSTTRGDIR)
@@ -1333,35 +1335,44 @@ def PerformDir(env, testdir, testlist, B
if not verbose and not quiet:
print('\nRunning in %s' % TSTDIR)
alllinks = []
+ pSrvr = None
try:
- for TST,COND in testlist:
- if global_timeout and start_time + global_timeout <
time.time():
- if not testweb:
- print('\nGlobal testing timeout reached\n')
- break
- tt, FtOut, FtErr, bodyline, reason =
0,F_SKIP,F_SKIP,None,"as the global timeout has been reached"
- else:
- os.environ['TST'] = TST
- tt, FtOut, FtErr, bodyline, reason, links = RunTest(env,
TST, BusyPorts, COND, oktests, length, all_tests)
- alllinks.extend(links)
- if tt:
- t = "%7.3f" % tt
- else:
- t = '-.---'
- TIMES.append((TSTDIR, TST, t, tt, FtOut, FtErr, reason))
- td += tt
- FdOut = max(FdOut,FtOut)
- FdErr = max(FdErr,FtErr)
- if bodyline is not None:
- if FtOut <= F_OK and FtErr <= F_OK:
- body_good.append(bodyline)
+ try:
+ if oneserver:
+ pSrvr = ServerClass()
+ pSrvr.LaunchIt(splitcommand(env['exe']['mserver5'][1]) +
['--dbpath=%s' % LogDBdir], open(os.devnull, 'w'), open(os.devnull, 'w'), 0,
os.path.join(LogDBdir, '.started'), int(env['MAPIPORT']))
+ for TST,COND in testlist:
+ if global_timeout and start_time + global_timeout <
time.time():
+ if not testweb:
+ print('\nGlobal testing timeout reached\n')
+ break
+ tt, FtOut, FtErr, bodyline, reason =
0,F_SKIP,F_SKIP,None,"as the global timeout has been reached"
+ else:
+ os.environ['TST'] = TST
+ tt, FtOut, FtErr, bodyline, reason, links =
RunTest(env, TST, BusyPorts, COND, oktests, length, all_tests, pSrvr)
+ alllinks.extend(links)
+ if tt:
+ t = "%7.3f" % tt
else:
- body_bad.append(bodyline)
- if FtOut in (F_OK, F_WARN) and FtErr in (F_OK, F_WARN):
- oktests.append(TST)
- except KeyboardInterrupt:
- print('\nInterrupted')
- interrupted = True
+ t = '-.---'
+ TIMES.append((TSTDIR, TST, t, tt, FtOut, FtErr, reason))
+ td += tt
+ FdOut = max(FdOut,FtOut)
+ FdErr = max(FdErr,FtErr)
+ if bodyline is not None:
+ if FtOut <= F_OK and FtErr <= F_OK:
+ body_good.append(bodyline)
+ else:
+ body_bad.append(bodyline)
+ if FtOut in (F_OK, F_WARN) and FtErr in (F_OK, F_WARN):
+ oktests.append(TST)
+ except KeyboardInterrupt:
+ print('\nInterrupted')
+ interrupted = True
+ finally:
+ if pSrvr is not None:
+ pSrvr.terminate()
+ pSrvr = None
TIMES.append((TSTDIR, '', "%7.3f" % td, td, FdOut, FdErr, None))
if testweb:
os.chdir(TSTTRGDIR)
@@ -1919,7 +1930,7 @@ relcond = {
'previous hugeint chained empty'),
}
-def RunTest(env, TST, BusyPorts, COND, oktests, length, all_tests) :
+def RunTest(env, TST, BusyPorts, COND, oktests, length, all_tests, pSrvr) :
global setpgrp
Failed = F_SKIP
FailedOut = F_SKIP
@@ -2136,11 +2147,14 @@ def RunTest(env, TST, BusyPorts, COND, o
raise
# Check for available sockets and block them until we're ready to run
the actual test
- MAPIsockets, reason = CheckSocket2(env, "MAPI") #, SrvrErr)
- if MAPIsockets is None:
- reason = 'as ' + reason
- elem = SkipTest(env, TST, EXT, reason, length)
- return TX,Failed,Failed,elem,reason,links
+ if pSrvr is None:
+ MAPIsockets, reason = CheckSocket2(env, "MAPI") #, SrvrErr)
+ if MAPIsockets is None:
+ reason = 'as ' + reason
+ elem = SkipTest(env, TST, EXT, reason, length)
+ return TX,Failed,Failed,elem,reason,links
+ else:
+ MAPIsockets = None
if os.path.isfile(TST+EXT+".src") and not os.path.isfile(TST+EXT):
f = openutf8(TST+EXT+".src","r")
@@ -2156,9 +2170,10 @@ def RunTest(env, TST, BusyPorts, COND, o
else:
reason = "as source file '%s` is missing." % TSTSRC
elem = SkipTest(env, TST, EXT+".src", reason, length)
- # Release reserved sockets before bailing out
- MAPIsockets[0].close()
- MAPIsockets[1].close()
+ if MAPIsockets is not None:
+ # Release reserved sockets before bailing out
+ MAPIsockets[0].close()
+ MAPIsockets[1].close()
return TX,Failed,Failed,elem,reason,links
test = re.compile("^"+TST+"((_[sp][0-9][0-9])?\..*)?\.src$",
re.MULTILINE)
for ff in listdir(TSTTRGDIR):
@@ -2249,7 +2264,7 @@ def RunTest(env, TST, BusyPorts, COND, o
TestErr.close()
t0 = time.time()
- tres = DoIt(env, SERVER, CALL, TST, EXT, TestOutFile, TestErrFile,
STIMEOUT, CTIMEOUT, TIMEOUT, ME, MAPIsockets, length, nomito, threads, user,
passwd, COND, all_tests)
+ tres = DoIt(env, SERVER, CALL, TST, EXT, TestOutFile, TestErrFile,
STIMEOUT, CTIMEOUT, TIMEOUT, ME, MAPIsockets, length, nomito, threads, user,
passwd, COND, all_tests, pSrvr)
t1 = time.time()
TX = t1 - t0
@@ -2273,7 +2288,10 @@ def RunTest(env, TST, BusyPorts, COND, o
else:
errcode = F_OK
- sockerr = CheckSocket3(env, "MAPI", TestErrFile)
+ if pSrvr is None:
+ sockerr = CheckSocket3(env, "MAPI", TestErrFile)
+ else:
+ sockerr = F_OK
#TODO:
##if [ ! -f $TSTTRGBASE/Tests/.old.left-over.tmp.bats. ] ; then touch
$TSTTRGBASE/Tests/.old.left-over.tmp.bats. ; fi
@@ -2974,7 +2992,7 @@ def mapi_ping(port) :
return False
### mapi_ping() #
-def DoIt(env, SERVER, CALL, TST, EXT, TestOutFile, TestErrFile, STIMEOUT,
CTIMEOUT, TIMEOUT, ME, MAPIsockets, length, nomito, threads, user, passwd,
COND, all_tests) :
+def DoIt(env, SERVER, CALL, TST, EXT, TestOutFile, TestErrFile, STIMEOUT,
CTIMEOUT, TIMEOUT, ME, MAPIsockets, length, nomito, threads, user, passwd,
COND, all_tests, PSRVR) :
ATJOB2 = ""
STDERR.flush()
if quiet:
@@ -3006,12 +3024,16 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
TSTDB = env['TSTDB']
exe = env['exe']
- # Release reserved sockets and run the actual test
- MAPIsockets[0].close()
- MAPIsockets[1].close()
+ if MAPIsockets is not None:
+ # Release reserved sockets and run the actual test
+ MAPIsockets[0].close()
+ MAPIsockets[1].close()
returncode = None
- pSrvr = ServerClass()
+ if PSRVR is None:
+ pSrvr = ServerClass()
+ else:
+ pSrvr = PSRVR
try:
if SERVER in ["MAL", "SQL"]:
SrvrOutFile = TST+".server.out"
@@ -3098,7 +3120,8 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
# enable C integration in server
Srvr.extend(['--set', 'embedded_c=true'])
- pSrvr.LaunchIt(Srvr, SrvrOut, SrvrErr, TIMEOUT,
os.path.join(dbpath, '.started'), int(env['MAPIPORT']))
+ if PSRVR is None:
+ pSrvr.LaunchIt(Srvr, SrvrOut, SrvrErr, TIMEOUT,
os.path.join(dbpath, '.started'), int(env['MAPIPORT']))
if savepath is not None:
os.environ['PATH'] = savepath
if savepypath:
@@ -3195,7 +3218,7 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
ClntErr.close()
if SERVER in ["MAL", "SQL"]:
- if pSrvr.started:
+ if PSRVR is None and pSrvr.started:
pSrvr.terminate()
if procdebug:
print('DoIt: process exited "%s" (%s)\n' % ('"
"'.join(Srvr), pSrvr.code))
@@ -3241,7 +3264,7 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te
TestErr.close()
except KeyboardInterrupt:
- if pSrvr.started:
+ if PSRVR is None and pSrvr.started:
pSrvr.kill(SrvrErr, Srvr)
raise
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list