diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-03-18 20:13:00 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-03-19 23:42:32 +0200 |
commit | 0568882d256eee42804ce2ff1c631782d6dc6b4b (patch) | |
tree | 2713fa17a24ef1959c7c55b180308f59f8678886 /run_unittests.py | |
parent | 158dc249cac0c8a53c34ddda366ada007a460c2f (diff) | |
download | meson-flock.tar.gz |
Grab a file lock on the build dir during modifications.flock
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 6e9970e24..ca85a0e51 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 @@ -1880,6 +1881,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): ''' |