tests/test-logtoprocess.t
branchstable
changeset 49492 b3e77d536b53
parent 48876 42d2b31cee0b
equal deleted inserted replaced
49490:37debd850c16 49492:b3e77d536b53
    81   $ cat $TESTTMP/uiblocked.log
    81   $ cat $TESTTMP/uiblocked.log
    82   uiblocked stdio [0-9]+.[0-9]* ms command [0-9]+.[0-9]* ms (re)
    82   uiblocked stdio [0-9]+.[0-9]* ms command [0-9]+.[0-9]* ms (re)
    83 
    83 
    84 Try to confirm that pager wait on logtoprocess:
    84 Try to confirm that pager wait on logtoprocess:
    85 
    85 
    86 Add a script that wait on a file to appears for 5 seconds, if it sees it touch
    86 Add a script that waits on a file to appear. If the script is awaited by hg,
    87 another file or die after 5 seconds. If the scripts is awaited by hg, the
    87 the script will die after the timeout before we could touch the file and the
    88 script will die after the timeout before we could touch the file and the
    88 resulting file will not exist. If not, we will touch the file and see it.
    89 resulting file will not exists. If not, we will touch the file and see it.
       
    90 
    89 
    91   $ cat >> fakepager.py <<EOF
    90   $ cat >> fakepager.py <<EOF
    92   > import sys
    91   > import sys
    93   > printed = False
    92   > printed = False
    94   > for line in sys.stdin:
    93   > for line in sys.stdin:
    98   >     sys.stdout.write('paged empty output!\n')
    97   >     sys.stdout.write('paged empty output!\n')
    99   > EOF
    98   > EOF
   100 
    99 
   101   $ cat > $TESTTMP/wait-output.sh << EOF
   100   $ cat > $TESTTMP/wait-output.sh << EOF
   102   > #!/bin/sh
   101   > #!/bin/sh
   103   > for i in \`$TESTDIR/seq.py 50\`; do
   102   > set -eu
   104   >   if [ -f "$TESTTMP/wait-for-touched" ];
   103   > "$RUNTESTDIR/testlib/wait-on-file" 10 "$TESTTMP/wait-for-touched"
   105   >   then
   104   > touch "$TESTTMP/touched"
   106   >     touch "$TESTTMP/touched";
       
   107   >     break;
       
   108   >   else
       
   109   >     sleep 0.1;
       
   110   >   fi
       
   111   > done
       
   112   > EOF
   105   > EOF
   113   $ chmod +x $TESTTMP/wait-output.sh
   106   $ chmod +x $TESTTMP/wait-output.sh
   114 
   107 
   115   $ cat >> $HGRCPATH << EOF
   108   $ cat >> $HGRCPATH << EOF
   116   > [extensions]
   109   > [extensions]
   122   > commandfinish=$TESTTMP/wait-output.sh
   115   > commandfinish=$TESTTMP/wait-output.sh
   123   > EOF
   116   > EOF
   124   $ hg version -q --pager=always
   117   $ hg version -q --pager=always
   125   Mercurial Distributed SCM (version *) (glob)
   118   Mercurial Distributed SCM (version *) (glob)
   126   $ touch $TESTTMP/wait-for-touched
   119   $ touch $TESTTMP/wait-for-touched
   127   $ sleep 0.2
   120   $ "$RUNTESTDIR/testlib/wait-on-file" 5 "$TESTTMP/touched"
   128   $ test -f $TESTTMP/touched && echo "SUCCESS Pager is not waiting on ltp" || echo "FAIL Pager is waiting on ltp"
   121   $ test -f $TESTTMP/touched && echo "SUCCESS Pager is not waiting on ltp" || echo "FAIL Pager is waiting on ltp"
   129   SUCCESS Pager is not waiting on ltp
   122   SUCCESS Pager is not waiting on ltp