tests/test-serve
author Patrick Mezard <pmezard@gmail.com>
Mon, 17 Mar 2008 16:15:43 +0100
changeset 6300 874ca958025b
parent 6262 de7256c82fad
child 6331 627665e37bdd
permissions -rwxr-xr-x
test-serve: replace copy/paste with shell function
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     1
#!/bin/sh
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     2
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
     3
hgserve()
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
     4
{
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
     5
    hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -v $@ \
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
     6
        | sed -e 's/:[0-9][0-9]*//g' -e 's/localhost\.localdomain/localhost/'
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
     7
    cat hg.pid >> "$DAEMON_PIDS"
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
     8
    sleep 1
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
     9
    kill `cat hg.pid`
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    10
    sleep 1
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    11
}
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    12
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    13
hg init test
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    14
cd test
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    15
4835
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
    16
echo '[web]' > .hg/hgrc
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
    17
echo 'accesslog = access.log' >> .hg/hgrc
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
    18
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    19
echo % Without -v
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4835
diff changeset
    20
hg serve -a localhost -p $HGPORT -d --pid-file=hg.pid
4506
9f952dd4413b test-serve: let run-tests.py kill the daemons
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4504
diff changeset
    21
cat hg.pid >> "$DAEMON_PIDS"
4835
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
    22
if [ -f access.log ]; then
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
    23
    echo 'access log created - .hg/hgrc respected'
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
    24
fi
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    25
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    26
echo % With -v
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    27
hgserve
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    28
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    29
echo % With --prefix foo
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    30
hgserve --prefix foo
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    31
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    32
echo % With --prefix /foo
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    33
hgserve --prefix /foo
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    34
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    35
echo % With --prefix foo/
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    36
hgserve --prefix foo/
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    37
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    38
echo % With --prefix /foo/
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    39
hgserve --prefix /foo/