diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 7463db4..a111037 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -28,6 +28,7 @@ jobs: pip install matplotlib pip install bokeh pip install pylint + pip install fasteners - name: Validate run: pylint --errors-only *.py diff --git a/regtest.py b/regtest.py index 5b6fbf9..e0a1493 100755 --- a/regtest.py +++ b/regtest.py @@ -21,6 +21,9 @@ import time import re import json +import fasteners +import tempfile +import getpass import params import test_util @@ -1293,5 +1296,17 @@ def email_developers(): if __name__ == "__main__": - n = test_suite(sys.argv[1:]) - sys.exit(n) + temp_dir = tempfile.gettempdir() + temp_file = os.path.join(temp_dir, 'amrex_regtest_lock_file_'+getpass.getuser()) + test_lock = fasteners.InterProcessLock(temp_file) + gotten = test_lock.acquire(blocking=False) + status = 255 + try: + if gotten: + status = test_suite(sys.argv[1:]) + else: + print("Wait please! Another process is running regression tests.") + finally: + if gotten: + test_lock.release() + sys.exit(status)