tests/test-lock-badness.t
branchstable
changeset 51497 9da3fcc5f70f
parent 50320 adecb1ab4a0d
equal deleted inserted replaced
51471:5633de951d34 51497:9da3fcc5f70f
    47   abort: expected release exception
    47   abort: expected release exception
    48   [255]
    48   [255]
    49 
    49 
    50 One process waiting for another
    50 One process waiting for another
    51 
    51 
    52   $ cat > hooks.py << EOF
    52   $ SYNC_FILE_LOCKED="$TESTTMP/sync-file-locked"
    53   > import time
    53   $ export SYNC_FILE_LOCKED
    54   > def sleepone(**x): time.sleep(1)
    54   $ SYNC_FILE_TRYING_LOCK="$TESTTMP/sync-file-trying-lock"
    55   > def sleephalf(**x): time.sleep(0.5)
    55   $ export SYNC_FILE_TRYING_LOCK
       
    56   $ cat << EOF > locker.sh
       
    57   > $RUNTESTDIR/testlib/wait-on-file 10 $SYNC_FILE_TRYING_LOCK $SYNC_FILE_LOCKED;
    56   > EOF
    58   > EOF
       
    59   $ cat << EOF > waiter.sh
       
    60   > $RUNTESTDIR/testlib/wait-on-file 10 $SYNC_FILE_LOCKED;
       
    61   > EOF
       
    62   $ clean_sync() {
       
    63   >   rm -f "$SYNC_FILE_LOCKED"
       
    64   >   rm -f "$SYNC_FILE_TRYING_LOCK"
       
    65   > }
       
    66 
       
    67 
       
    68   $ clean_sync
    57   $ echo b > b/b
    69   $ echo b > b/b
    58   $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout &
    70   $ hg -R b ci -A -m b \
    59   $ hg -R b up -q --config ui.timeout.warn=0 --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf" \
    71   >   --config hooks.precommit="sh $TESTTMP/locker.sh" \
    60   > > preup-stdout 2>preup-stderr
    72   >   > stdout &
       
    73   $ hg -R b up -q \
       
    74   >   --config ui.timeout.warn=0 \
       
    75   >   --config hooks.pre-update="sh $TESTTMP/waiter.sh" \
       
    76   >   --config devel.lock-wait-sync-file="$SYNC_FILE_TRYING_LOCK" \
       
    77   >   > preup-stdout 2> preup-stderr
    61   $ wait
    78   $ wait
    62   $ cat preup-stdout
    79   $ cat preup-stdout
    63   $ cat preup-stderr
    80   $ cat preup-stderr
    64   waiting for lock on working directory of b held by process '*' on host '*' (glob)
    81   waiting for lock on working directory of b held by process '*' on host '*' (glob)
    65   got lock after * seconds (glob)
    82   got lock after * seconds (glob)
    66   $ cat stdout
    83   $ cat stdout
    67   adding b
    84   adding b
    68 
    85 
    69 On processs waiting on another, warning after a long time.
    86 On processs waiting on another, warning after a long time.
    70 
    87 
       
    88   $ clean_sync
    71   $ echo b > b/c
    89   $ echo b > b/c
    72   $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout &
    90   $ hg -R b ci -A -m b \
    73   $ hg -R b up -q --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf" \
    91   >   --config hooks.precommit="sh $TESTTMP/locker.sh" \
    74   > --config ui.timeout.warn=250 \
    92   >   > stdout &
    75   > > preup-stdout 2>preup-stderr
    93   $ hg -R b up -q \
       
    94   >   --config hooks.pre-update="sh $TESTTMP/waiter.sh" \
       
    95   >   --config devel.lock-wait-sync-file="$SYNC_FILE_TRYING_LOCK" \
       
    96   >   --config ui.timeout.warn=250 \
       
    97   >   > preup-stdout 2> preup-stderr
    76   $ wait
    98   $ wait
    77   $ cat preup-stdout
    99   $ cat preup-stdout
    78   $ cat preup-stderr
   100   $ cat preup-stderr
    79   $ cat stdout
   101   $ cat stdout
    80   adding c
   102   adding c
    81 
   103 
    82 On processs waiting on another, warning disabled.
   104 On processs waiting on another, warning disabled.
    83 
   105 
       
   106   $ clean_sync
    84   $ echo b > b/d
   107   $ echo b > b/d
    85   $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout &
   108   $ hg -R b ci -A -m b \
    86   $ hg -R b up -q --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf" \
   109   >   --config hooks.precommit="sh $TESTTMP/locker.sh" \
    87   > --config ui.timeout.warn=-1 \
   110   >   > stdout &
    88   > > preup-stdout 2>preup-stderr
   111   $ hg -R b up -q \
       
   112   >   --config hooks.pre-update="sh $TESTTMP/waiter.sh" \
       
   113   >   --config devel.lock-wait-sync-file="$SYNC_FILE_TRYING_LOCK" \
       
   114   >   --config ui.timeout.warn=-1 \
       
   115   >   > preup-stdout 2>preup-stderr
    89   $ wait
   116   $ wait
    90   $ cat preup-stdout
   117   $ cat preup-stdout
    91   $ cat preup-stderr
   118   $ cat preup-stderr
    92   $ cat stdout
   119   $ cat stdout
    93   adding d
   120   adding d
    94 
   121 
    95 check we still print debug output
   122 check we still print debug output
    96 
   123 
    97 On processs waiting on another, warning after a long time (debug output on)
   124 On processs waiting on another, warning after a long time (debug output on)
    98 
   125 
       
   126   $ clean_sync
    99   $ echo b > b/e
   127   $ echo b > b/e
   100   $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout &
   128   $ hg -R b ci -A -m b \
   101   $ hg -R b up --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf" \
   129   >   --config hooks.precommit="sh $TESTTMP/locker.sh" \
   102   > --config ui.timeout.warn=250 --debug\
   130   >   > stdout &
   103   > > preup-stdout 2>preup-stderr
   131   $ hg -R b up \
       
   132   >   --config hooks.pre-update="sh $TESTTMP/waiter.sh" \
       
   133   >   --config devel.lock-wait-sync-file="$SYNC_FILE_TRYING_LOCK" \
       
   134   >   --config ui.timeout.warn=250 --debug \
       
   135   >   > preup-stdout 2>preup-stderr
   104   $ wait
   136   $ wait
   105   $ cat preup-stdout
   137   $ cat preup-stdout
   106   calling hook pre-update: hghook_pre-update.sleephalf
   138   running hook pre-update: sh $TESTTMP/waiter.sh
   107   waiting for lock on working directory of b held by process '*' on host '*' (glob)
   139   waiting for lock on working directory of b held by process '*' on host '*' (glob)
   108   got lock after * seconds (glob)
   140   got lock after * seconds (glob)
   109   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   141   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   110   $ cat preup-stderr
   142   $ cat preup-stderr
   111   $ cat stdout
   143   $ cat stdout
   112   adding e
   144   adding e
   113 
   145 
   114 On processs waiting on another, warning disabled, (debug output on)
   146 On processs waiting on another, warning disabled, (debug output on)
   115 
   147 
       
   148   $ clean_sync
   116   $ echo b > b/f
   149   $ echo b > b/f
   117   $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout &
   150   $ hg -R b ci -A -m b \
   118   $ hg -R b up --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf" \
   151   >   --config hooks.precommit="sh $TESTTMP/locker.sh" \
   119   > --config ui.timeout.warn=-1 --debug\
   152   >   > stdout &
   120   > > preup-stdout 2>preup-stderr
   153   $ hg -R b up \
       
   154   >   --config hooks.pre-update="sh $TESTTMP/waiter.sh" \
       
   155   >   --config devel.lock-wait-sync-file="$SYNC_FILE_TRYING_LOCK" \
       
   156   >   --config ui.timeout.warn=-1 --debug\
       
   157   >   > preup-stdout 2>preup-stderr
   121   $ wait
   158   $ wait
   122   $ cat preup-stdout
   159   $ cat preup-stdout
   123   calling hook pre-update: hghook_pre-update.sleephalf
   160   running hook pre-update: sh $TESTTMP/waiter.sh
   124   waiting for lock on working directory of b held by process '*' on host '*' (glob)
   161   waiting for lock on working directory of b held by process '*' on host '*' (glob)
   125   got lock after * seconds (glob)
   162   got lock after * seconds (glob)
   126   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   163   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   127   $ cat preup-stderr
   164   $ cat preup-stderr
   128   $ cat stdout
   165   $ cat stdout