diff tests/test-devel-warnings.t @ 33436:9bb4decd43b0

repovfs: add a ward to check if locks are properly taken When the appropriate developer warnings are enabled, We wrap 'repo.vfs.audit' to check for locks when accessing file in '.hg' for writing. Another changeset will add a 'ward' for the store vfs (svfs). This check system has caught a handful of locking issues that have been fixed in previous series (mostly in 4.0). I expect another batch to be caught in third party extensions. We introduce two real exceptions from extensions 'blackbox.log' (because a lot of read-only operations add entry to it), and 'last-email.txt' (because 'hg email' is currently a read only operation and there is value to keep it this way). In addition we are currently allowing bisect to operate outside of the lock because the current code is a bit hard to get properly locked for now. Multiple clean up have been made but there is still a couple of them to do and the freeze is coming.
author Boris Feld <boris.feld@octobus.net>
date Tue, 11 Jul 2017 12:38:17 +0200
parents 9359cd9345a9
children 0720e6265c8a
line wrap: on
line diff
--- a/tests/test-devel-warnings.t	Tue Jul 11 12:27:58 2017 +0200
+++ b/tests/test-devel-warnings.t	Tue Jul 11 12:38:17 2017 +0200
@@ -44,6 +44,11 @@
   >     wl.release()
   >     lo.release()
   > 
+  > @command(b'no-wlock-write', [], '')
+  > def nowlockwrite(ui, repo):
+  >     with repo.vfs(b'branch', 'a'):
+  >         pass
+  > 
   > @command(b'stripintr', [], '')
   > def stripintr(ui, repo):
   >     lo = repo.lock()
@@ -104,6 +109,11 @@
   $ hg properlocking
   $ hg nowaitlocking
 
+Writing without lock
+
+  $ hg no-wlock-write
+  devel-warn: write with no wlock: "branch" at: $TESTTMP/buggylocking.py:* (nowlockwrite) (glob)
+
 Stripping from a transaction
 
   $ echo a > a