tests/test-serve
branchstable
changeset 14687 15200b46165b
parent 14508 07722bb8a08c
parent 14686 6ab8b17adc03
child 14688 e2da6eee7950
equal deleted inserted replaced
14508:07722bb8a08c 14687:15200b46165b
     1 #!/bin/sh
       
     2 
       
     3 hgserve()
       
     4 {
       
     5     hg serve -a localhost -d --pid-file=hg.pid -E errors.log -v $@ \
       
     6         | sed -e "s/:$HGPORT1\\([^0-9]\\)/:HGPORT1\1/g" \
       
     7               -e "s/:$HGPORT2\\([^0-9]\\)/:HGPORT2\1/g" \
       
     8               -e 's/http:\/\/[^/]*\//http:\/\/localhost\//'
       
     9     cat hg.pid >> "$DAEMON_PIDS"
       
    10     echo % errors
       
    11     cat errors.log
       
    12     sleep 1
       
    13     if [ "$KILLQUIETLY" = "Y" ]; then
       
    14         kill `cat hg.pid` 2>/dev/null
       
    15     else
       
    16         kill `cat hg.pid`
       
    17     fi
       
    18     sleep 1
       
    19 }
       
    20 
       
    21 hg init test
       
    22 cd test
       
    23 
       
    24 echo '[web]' > .hg/hgrc
       
    25 echo 'accesslog = access.log' >> .hg/hgrc
       
    26 echo "port = $HGPORT1" >> .hg/hgrc
       
    27 
       
    28 echo % Without -v
       
    29 hg serve -a localhost -p $HGPORT -d --pid-file=hg.pid -E errors.log
       
    30 cat hg.pid >> "$DAEMON_PIDS"
       
    31 if [ -f access.log ]; then
       
    32     echo 'access log created - .hg/hgrc respected'
       
    33 fi
       
    34 echo % errors
       
    35 cat errors.log
       
    36 
       
    37 echo % With -v
       
    38 hgserve
       
    39 
       
    40 echo % With -v and -p HGPORT2
       
    41 hgserve -p "$HGPORT2"
       
    42 
       
    43 echo '% With -v and -p daytime (should fail because low port)'
       
    44 KILLQUIETLY=Y
       
    45 hgserve -p daytime
       
    46 KILLQUIETLY=N
       
    47 
       
    48 echo % With --prefix foo
       
    49 hgserve --prefix foo
       
    50 
       
    51 echo % With --prefix /foo
       
    52 hgserve --prefix /foo
       
    53 
       
    54 echo % With --prefix foo/
       
    55 hgserve --prefix foo/
       
    56 
       
    57 echo % With --prefix /foo/
       
    58 hgserve --prefix /foo/