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

When not running parallel, don't use ThreadPoolExecutor.
This means, when not running parallel, interrupting the test run is a
lot more reliable.


diffs (76 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -4134,34 +4134,49 @@ def main(argv) :
                 testdirs = [d for (prio, d) in sorted(td)]
                 if verbosity > 1:
                     print('\nRunning all tests in directories %s.\n' % 
str(testdirs))
-                with 
concurrent.futures.ThreadPoolExecutor(max_workers=opts.parallel) as tp:
-                    try:
+                tp = None
+                try:
+                    if opts.parallel > 1 and len(testdirs) > 1:
+                        tp = 
concurrent.futures.ThreadPoolExecutor(max_workers=opts.parallel)
                         futures = {tp.submit(PerformDir, env, d, [], 
test_count): d for d in testdirs}
-                        for future in concurrent.futures.as_completed(futures):
+                        iter = concurrent.futures.as_completed(futures)
+                    else:
+                        iter = testdirs
+                    for d in iter:
+                        if tp is not None:
+                            future = d
                             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:
+                        else:
+                            elem, diff, interrupted = PerformDir(env, d, [], 
test_count)
+                        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)
-                    except KeyboardInterrupt:
+                            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)
+                except KeyboardInterrupt:
+                    if tp is not None:
                         tp.shutdown(cancel_futures=True)
-                        raise
+                        tp = None
+                    raise
+                finally:
+                    if tp is not None:
+                        tp.shutdown(wait=True)
+                        tp = None
             if verbosity == 0:
                 print()
         except KeyboardInterrupt:
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to