changeset 47780:4870a8dc24d9 stable

test-transaction-safety: document the test schedule This helps reader to understand how the test work and actually helped me to detect a missing synchronisation step. Differential Revision: https://phab.mercurial-scm.org/D11215
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 27 Jul 2021 00:44:57 +0200
parents cf5f8da2244c
children ebfc315c6077
files tests/test-transaction-safety.t
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-transaction-safety.t	Thu Jul 29 12:22:25 2021 +0200
+++ b/tests/test-transaction-safety.t	Tue Jul 27 00:44:57 2021 +0200
@@ -41,7 +41,23 @@
 setup
 -----
 
-synchronisation+output script:
+synchronisation+output script using the following schedule:
+
+[A1] "external"       is started
+[A2] "external"       waits on EXT_UNLOCK
+[A2] "external"       + creates EXT_WAITING → unlocks [C1]
+[B1] "hg commit/pull" is started
+[B2] "hg commit/pull" is ready to be committed
+[B3] "hg commit/pull" spawn "internal" using a pretxnclose hook (need [C4])
+[C1] "internal"       waits on EXT_WAITING (need [A2])
+[C2] "internal"       show the tipmost revision (inside of the transaction)
+[C3] "internal"       waits on EXT_DONE (need [A4])
+[C3] "internal"       + creates EXT_UNLOCK → unlocks [A2]
+[A3] "external"       show the tipmost revision (outside of the transaction)
+[A4] "external"       creates EXT_DONE → unlocks [C3]
+[C4] "internal"       end of execution -> unlock [B3]
+[B4] "hg commit/pull" transaction is committed on disk
+
 
   $ mkdir sync
   $ mkdir output
@@ -60,6 +76,7 @@
   > EOF
   $ cat << EOF > script/internal.sh
   > #!/bin/sh
+  > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_WAITING"
   > hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > "$TESTTMP/output/internal.out"
   > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_DONE" "$HG_TEST_FILE_EXT_UNLOCK"
   > EOF