tests/test-transaction-rollback-on-sigpipe.t
changeset 47306 aa07bcc4f505
parent 47301 97f04eaafa65
child 47555 452795b0b69a
equal deleted inserted replaced
47305:33e7508b0ae9 47306:aa07bcc4f505
     1 #require bash
     1 #require bash
     2 Test that, when an hg push is interrupted and the remote side recieves SIGPIPE,
     2 Test that, when an hg push is interrupted and the remote side receives SIGPIPE,
     3 the remote hg is able to successfully roll back the transaction.
     3 the remote hg is able to successfully roll back the transaction.
     4 
     4 
     5   $ hg init -q remote
     5   $ hg init -q remote
     6   $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" -q ssh://user@dummy/`pwd`/remote local
     6   $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" -q ssh://user@dummy/`pwd`/remote local
     7 
       
     8   $ check_for_abandoned_transaction() {
       
     9   >     [ -f $TESTTMP/remote/.hg/store/journal ] && echo "Abandoned transaction!"
       
    10   > }
       
    11 
     7 
    12   $ pidfile=`pwd`/pidfile
     8   $ pidfile=`pwd`/pidfile
    13   $ >$pidfile
     9   $ >$pidfile
    14 
    10 
    15   $ script() {
    11   $ script() {
    57   $ cd local
    53   $ cd local
    58   $ echo foo > foo ; hg commit -qAm "commit"
    54   $ echo foo > foo ; hg commit -qAm "commit"
    59   $ hg push -q -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --remotecmd $remotecmd 2>&1 | grep -v $killable_pipe
    55   $ hg push -q -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --remotecmd $remotecmd 2>&1 | grep -v $killable_pipe
    60   abort: stream ended unexpectedly (got 0 bytes, expected 4)
    56   abort: stream ended unexpectedly (got 0 bytes, expected 4)
    61 
    57 
    62   $ check_for_abandoned_transaction
    58 The remote should be left in a good state
       
    59   $ hg --cwd ../remote recover
       
    60   no interrupted transaction available
    63   [1]
    61   [1]