tests/test-serve
author Greg Ward <greg-hg@gerg.ca>
Tue, 15 Jun 2010 13:04:22 -0400
changeset 11402 367ce8514da0
parent 10633 3318431f2ab4
child 12076 49463314c24f
permissions -rwxr-xr-x
extensions: recommend against using wrapfunction for repo methods Instead, all extensions should use the "dynamic subclass" trick: subclass repo.__class__ and then replace repo.__class__ with your new subclass. This avoids conflicts that happen when one extension uses wrapfunction and another uses subclassing to extend the same method of localrepository.
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
{
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
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    13
    kill `cat hg.pid`
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    14
    sleep 1
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    15
}
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    16
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    17
hg init test
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    18
cd test
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    19
4835
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
    20
echo '[web]' > .hg/hgrc
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
    21
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
    22
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
    23
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    24
echo % Without -v
6461
eb69e7989145 tests: easier error diagnostics for test-serve
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6331
diff changeset
    25
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
    26
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
    27
if [ -f access.log ]; then
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
    28
    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
    29
fi
6461
eb69e7989145 tests: easier error diagnostics for test-serve
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6331
diff changeset
    30
echo % errors
eb69e7989145 tests: easier error diagnostics for test-serve
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6331
diff changeset
    31
cat errors.log
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    32
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    33
echo % With -v
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    34
hgserve
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    35
10633
3318431f2ab4 test-serve: Show if port config and option are correctly used
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6461
diff changeset
    36
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
    37
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
    38
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    39
echo % With --prefix foo
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    40
hgserve --prefix foo
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    41
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    42
echo % With --prefix /foo
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    43
hgserve --prefix /foo
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    44
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    45
echo % With --prefix foo/
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    46
hgserve --prefix foo/
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    47
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
    48
echo % With --prefix /foo/
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
    49
hgserve --prefix /foo/