annotate tests/test-serve @ 12269:877236cdd437

add: move main part to cmdutil to make it easier to reuse
author Martin Geisler <mg@lazybytes.net>
date Mon, 13 Sep 2010 13:09:11 +0200
parents b6cc68ef2702
children ba8850911703
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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 {
10633
3318431f2ab4 test-serve: Show if port config and option are correctly used
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6461
diff changeset
5 hg serve -a localhost -d --pid-file=hg.pid -E errors.log -v $@ \
3318431f2ab4 test-serve: Show if port config and option are correctly used
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6461
diff changeset
6 | sed -e "s/:$HGPORT1\\([^0-9]\\)/:HGPORT1\1/g" \
3318431f2ab4 test-serve: Show if port config and option are correctly used
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6461
diff changeset
7 -e "s/:$HGPORT2\\([^0-9]\\)/:HGPORT2\1/g" \
3318431f2ab4 test-serve: Show if port config and option are correctly used
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6461
diff changeset
8 -e 's/http:\/\/[^/]*\//http:\/\/localhost\//'
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
9 cat hg.pid >> "$DAEMON_PIDS"
6461
eb69e7989145 tests: easier error diagnostics for test-serve
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6331
diff changeset
10 echo % errors
eb69e7989145 tests: easier error diagnostics for test-serve
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6331
diff changeset
11 cat errors.log
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
12 sleep 1
12076
49463314c24f mail/hgweb: support service names for ports (issue2350)
Brodie Rao <brodie@bitheap.org>
parents: 10633
diff changeset
13 if [ "$KILLQUIETLY" = "Y" ]; then
49463314c24f mail/hgweb: support service names for ports (issue2350)
Brodie Rao <brodie@bitheap.org>
parents: 10633
diff changeset
14 kill `cat hg.pid` 2>/dev/null
49463314c24f mail/hgweb: support service names for ports (issue2350)
Brodie Rao <brodie@bitheap.org>
parents: 10633
diff changeset
15 else
49463314c24f mail/hgweb: support service names for ports (issue2350)
Brodie Rao <brodie@bitheap.org>
parents: 10633
diff changeset
16 kill `cat hg.pid`
49463314c24f mail/hgweb: support service names for ports (issue2350)
Brodie Rao <brodie@bitheap.org>
parents: 10633
diff changeset
17 fi
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
18 sleep 1
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
19 }
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
20
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
21 hg init test
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
22 cd test
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
23
4835
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
24 echo '[web]' > .hg/hgrc
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
25 echo 'accesslog = access.log' >> .hg/hgrc
10633
3318431f2ab4 test-serve: Show if port config and option are correctly used
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6461
diff changeset
26 echo "port = $HGPORT1" >> .hg/hgrc
4835
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
27
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
28 echo % Without -v
6461
eb69e7989145 tests: easier error diagnostics for test-serve
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6331
diff changeset
29 hg serve -a localhost -p $HGPORT -d --pid-file=hg.pid -E errors.log
4506
9f952dd4413b test-serve: let run-tests.py kill the daemons
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4504
diff changeset
30 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
31 if [ -f access.log ]; then
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
32 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
33 fi
6461
eb69e7989145 tests: easier error diagnostics for test-serve
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6331
diff changeset
34 echo % errors
eb69e7989145 tests: easier error diagnostics for test-serve
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6331
diff changeset
35 cat errors.log
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
36
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
37 echo % With -v
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
38 hgserve
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
39
10633
3318431f2ab4 test-serve: Show if port config and option are correctly used
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6461
diff changeset
40 echo % With -v and -p HGPORT2
3318431f2ab4 test-serve: Show if port config and option are correctly used
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6461
diff changeset
41 hgserve -p "$HGPORT2"
3318431f2ab4 test-serve: Show if port config and option are correctly used
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6461
diff changeset
42
12076
49463314c24f mail/hgweb: support service names for ports (issue2350)
Brodie Rao <brodie@bitheap.org>
parents: 10633
diff changeset
43 echo '% With -v and -p http (should fail)'
12135
b6cc68ef2702 test-serve: ensure KILLQUIETLY is only used once
Brodie Rao <brodie@bitheap.org>
parents: 12076
diff changeset
44 KILLQUIETLY=Y hgserve -p http; KILLQUIETLY=N
12076
49463314c24f mail/hgweb: support service names for ports (issue2350)
Brodie Rao <brodie@bitheap.org>
parents: 10633
diff changeset
45
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
46 echo % With --prefix foo
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
47 hgserve --prefix foo
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
48
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
49 echo % With --prefix /foo
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
50 hgserve --prefix /foo
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
51
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
52 echo % With --prefix foo/
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
53 hgserve --prefix foo/
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
54
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
55 echo % With --prefix /foo/
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
56 hgserve --prefix /foo/