Changeset: ca834c06fb37 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ca834c06fb37
Modified Files:
testing/Mtest.py.in
Branch: default
Log Message:
Improve reporting of run time.
Also use the parallel code even when not running in parallel mode
because, why not?
diffs (166 lines):
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -1126,7 +1126,7 @@ def PerformDir(env, testdir, testlist, t
testlist = alltests
if not testlist:
Warn("No tests found in '%s`; skipping directory!" % TSTSRCDIR)
- return td, elem, max(FdOut, FdErr), interrupted
+ return elem, max(FdOut, FdErr), interrupted
# find length of longest test name
length = 0
@@ -1161,14 +1161,14 @@ def PerformDir(env, testdir, testlist, t
raise
except:
Warn("database '%s` exists, but destroying it failed;
skipping tests in '%s`!" % (TSTDB, TSTSRCDIR))
- return td, elem, max(FdOut, FdErr), interrupted
+ return elem, max(FdOut, FdErr), interrupted
keyfile = os.path.join(LogDBdir, '.vaultkey')
if os.path.isabs(LogDBdir) and not os.path.exists(LogDBdir):
try:
os.makedirs(LogDBdir)
except:
Warn("creating database '%s` failed; skipping tests in
'%s`!" % (TSTDB, TSTSRCDIR))
- return td, elem, max(FdOut, FdErr), interrupted
+ return elem, max(FdOut, FdErr), interrupted
else:
if not initdb:
vaultkey = secrets.token_urlsafe(32).encode('ascii')
@@ -1181,14 +1181,14 @@ def PerformDir(env, testdir, testlist, t
z = zipfile.ZipFile(initdb)
except IOError:
Warn("initial database '%s` cannot be opened; skipping
tests in '%s`!" % (initdb, TSTSRCDIR))
- return td, elem, max(FdOut, FdErr), interrupted
+ return elem, max(FdOut, FdErr), interrupted
try:
z.extractall(LogDBdir)
except KeyboardInterrupt:
raise
except:
Warn("initial database '%s` cannot be extracted; skipping
tests in '%s`!" % (initdb, TSTSRCDIR))
- return td, elem, max(FdOut, FdErr), interrupted
+ return elem, max(FdOut, FdErr), interrupted
z.close()
if os.path.exists(keyfile):
vaultopt = ['--set', f'monet_vault_key={keyfile}']
@@ -1433,7 +1433,7 @@ def PerformDir(env, testdir, testlist, t
except:
pass
- return td, elem, max(FdOut, FdErr, ssout, sserr), interrupted
+ return elem, max(FdOut, FdErr, ssout, sserr), interrupted
finally:
# del sys.path[0]
pass
@@ -3532,6 +3532,8 @@ def main(argv) :
sys.exit(1)
logging.basicConfig(level=level)
+ if opts.parallel < 1:
+ opts.parallel = 1
recursive = opts.recursive
global testweb
testweb = False
@@ -4080,6 +4082,7 @@ def main(argv) :
print(f'{k}={os.environ[k]}')
print(file=sys.stderr, end='', flush=True)
t_ = 0
+ t0 = time.time()
body_good = []
body_bad = []
errseen = False
@@ -4091,7 +4094,7 @@ def main(argv) :
tsts = 'all tests'
if verbosity > 1:
print('\nRunning %s in directory %s.\n' % (tsts ,
testdirs[0]))
- t_, elem, diff, interrupted = PerformDir(env, testdirs[0],
testlist, test_count)
+ elem, diff, interrupted = PerformDir(env, testdirs[0],
testlist, test_count)
if elem is not None:
if diff <= F_OK:
body_good.append(elem)
@@ -4102,60 +4105,36 @@ def main(argv) :
else:
if verbosity > 1:
print('\nRunning all tests in directories %s.\n' %
str(testdirs))
- if opts.parallel > 1:
- with
concurrent.futures.ThreadPoolExecutor(max_workers=opts.parallel) as tp:
- futures = {tp.submit(PerformDir, env, d, [],
test_count): d for d in testdirs}
- for future in concurrent.futures.as_completed(futures):
- d = futures[future]
- t, elem, diff, interrupted = future.result()
- t_ = t_ + t
- if elem is not None:
- if diff <= F_OK:
- body_good.append(elem)
- else:
- body_bad.append(elem)
- if not errseen and diff > F_WARN:
- errseen = True
- if interrupted:
+ with
concurrent.futures.ThreadPoolExecutor(max_workers=opts.parallel) as tp:
+ futures = {tp.submit(PerformDir, env, d, [], test_count):
d for d in testdirs}
+ for future in concurrent.futures.as_completed(futures):
+ d = futures[future]
+ elem, diff, interrupted = future.result()
+ if elem is not None:
+ if diff <= F_OK:
+ body_good.append(elem)
+ else:
+ body_bad.append(elem)
+ if not errseen and diff > F_WARN:
+ errseen = True
+ if interrupted:
+ break
+ if not testweb:
+ if global_timeout and start_time + global_timeout <
time.time():
+ print('\nGlobal testing timeout reached\n')
break
- if not testweb:
- if global_timeout and start_time + global_timeout
< time.time():
- print('\nGlobal testing timeout reached\n')
- break
- if produce_html:
- # after a directory has been tested, create
- # the index file so that we can look at test
- # results while the tests are running
- body = body_bad + body_good
- CreateHtmlIndex(env, '',
os.path.join(TSTTRGBASE, TSTPREF), F_SKIP, F_SKIP, *body)
- else:
- for d in testdirs:
- t, elem, diff, interrupted = PerformDir(env, d, [],
test_count)
- t_ = t_ + t
- if elem is not None:
- if diff <= F_OK:
- body_good.append(elem)
- else:
- body_bad.append(elem)
- if not errseen and diff > F_WARN:
- errseen = True
- if interrupted:
- break
- if not testweb:
- if global_timeout and start_time + global_timeout
< time.time():
- print('\nGlobal testing timeout reached\n')
- break
- if produce_html:
- # after a directory has been tested, create
- # the index file so that we can look at test
- # results while the tests are running
- body = body_bad + body_good
- CreateHtmlIndex(env, '',
os.path.join(TSTTRGBASE, TSTPREF), F_SKIP, F_SKIP, *body)
+ if produce_html:
+ # after a directory has been tested, create
+ # the index file so that we can look at test
+ # results while the tests are running
+ body = body_bad + body_good
+ CreateHtmlIndex(env, '', os.path.join(TSTTRGBASE,
TSTPREF), F_SKIP, F_SKIP, *body)
if verbosity == 0:
print()
except KeyboardInterrupt:
# if we get interrupted between directories, we still want output
pass
+ t_ = time.time() - t0
body = body_bad + body_good
if not os.path.exists(os.path.join(TSTTRGBASE, TSTPREF)):
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]