diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-03-18 20:13:00 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-03-20 22:28:37 +0200 |
commit | 58156ef7cfd56ddcbd230c510f363f49a2c172fd (patch) | |
tree | 5761bcf68322f044c3ea50616486e2323c10f9e1 /run_unittests.py | |
parent | 1c8d4bf05b85b0e9f7dc5b1438f4e33b515db668 (diff) | |
download | meson-58156ef7cfd56ddcbd230c510f363f49a2c172fd.zip meson-58156ef7cfd56ddcbd230c510f363f49a2c172fd.tar.gz meson-58156ef7cfd56ddcbd230c510f363f49a2c172fd.tar.bz2 |
Grab a file lock on the build dir during modifications.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index 3ea0412..b6367c1 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -37,6 +37,7 @@ from mesonbuild.interpreter import ObjectHolder from mesonbuild.mesonlib import ( is_windows, is_osx, is_cygwin, is_dragonflybsd, windows_proof_rmtree, python_command, meson_command, version_compare, + BuildDirLock ) from mesonbuild.environment import Environment, detect_ninja from mesonbuild.mesonlib import MesonException, EnvironmentException @@ -1882,6 +1883,18 @@ int main(int argc, char **argv) { self.init(testdir, extra_args=['--layout=flat']) self.build() + def test_flock(self): + exception_raised = False + with tempfile.TemporaryDirectory() as tdir: + os.mkdir(os.path.join(tdir, 'meson-private')) + with BuildDirLock(tdir): + try: + with BuildDirLock(tdir): + pass + except MesonException: + exception_raised = True + self.assertTrue(exception_raised, 'Double locking did not raise exception.') + class FailureTests(BasePlatformTests): ''' |