tests/test-transaction-safety.t
branchstable
changeset 47781 4870a8dc24d9
parent 47313 b1ce93dcdf3c
child 47782 ebfc315c6077
equal deleted inserted replaced
47780:cf5f8da2244c 47781:4870a8dc24d9
    39 # TODO: also add stream clone and hardlink clone happening during these transaction.
    39 # TODO: also add stream clone and hardlink clone happening during these transaction.
    40 
    40 
    41 setup
    41 setup
    42 -----
    42 -----
    43 
    43 
    44 synchronisation+output script:
    44 synchronisation+output script using the following schedule:
       
    45 
       
    46 [A1] "external"       is started
       
    47 [A2] "external"       waits on EXT_UNLOCK
       
    48 [A2] "external"       + creates EXT_WAITING → unlocks [C1]
       
    49 [B1] "hg commit/pull" is started
       
    50 [B2] "hg commit/pull" is ready to be committed
       
    51 [B3] "hg commit/pull" spawn "internal" using a pretxnclose hook (need [C4])
       
    52 [C1] "internal"       waits on EXT_WAITING (need [A2])
       
    53 [C2] "internal"       show the tipmost revision (inside of the transaction)
       
    54 [C3] "internal"       waits on EXT_DONE (need [A4])
       
    55 [C3] "internal"       + creates EXT_UNLOCK → unlocks [A2]
       
    56 [A3] "external"       show the tipmost revision (outside of the transaction)
       
    57 [A4] "external"       creates EXT_DONE → unlocks [C3]
       
    58 [C4] "internal"       end of execution -> unlock [B3]
       
    59 [B4] "hg commit/pull" transaction is committed on disk
       
    60 
    45 
    61 
    46   $ mkdir sync
    62   $ mkdir sync
    47   $ mkdir output
    63   $ mkdir output
    48   $ mkdir script
    64   $ mkdir script
    49   $ HG_TEST_FILE_EXT_WAITING=$TESTTMP/sync/ext_waiting
    65   $ HG_TEST_FILE_EXT_WAITING=$TESTTMP/sync/ext_waiting
    58   > hg log --rev 'tip' -T 'external: {rev} {desc}\n' > "$TESTTMP/output/external.out"
    74   > hg log --rev 'tip' -T 'external: {rev} {desc}\n' > "$TESTTMP/output/external.out"
    59   > touch "$HG_TEST_FILE_EXT_DONE"
    75   > touch "$HG_TEST_FILE_EXT_DONE"
    60   > EOF
    76   > EOF
    61   $ cat << EOF > script/internal.sh
    77   $ cat << EOF > script/internal.sh
    62   > #!/bin/sh
    78   > #!/bin/sh
       
    79   > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_WAITING"
    63   > hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > "$TESTTMP/output/internal.out"
    80   > hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > "$TESTTMP/output/internal.out"
    64   > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_DONE" "$HG_TEST_FILE_EXT_UNLOCK"
    81   > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_DONE" "$HG_TEST_FILE_EXT_UNLOCK"
    65   > EOF
    82   > EOF
    66 
    83 
    67 
    84