##// END OF EJS Templates
tests: convert test-serve to new format
Patrick Mezard -
r13540:3ecadce9 default
parent child Browse files
Show More
@@ -1,58 +1,82 b''
1 #!/bin/sh
1
2 $ hgserve()
3 > {
4 > hg serve -a localhost -d --pid-file=hg.pid -E errors.log -v $@ \
5 > | sed -e "s/:$HGPORT1\\([^0-9]\\)/:HGPORT1\1/g" \
6 > -e "s/:$HGPORT2\\([^0-9]\\)/:HGPORT2\1/g" \
7 > -e 's/http:\/\/[^/]*\//http:\/\/localhost\//'
8 > cat hg.pid >> "$DAEMON_PIDS"
9 > echo % errors
10 > cat errors.log
11 > sleep 1
12 > if [ "$KILLQUIETLY" = "Y" ]; then
13 > kill `cat hg.pid` 2>/dev/null
14 > else
15 > kill `cat hg.pid`
16 > fi
17 > sleep 1
18 > }
2
19
3 hgserve()
20 $ hg init test
4 {
21 $ cd test
5 hg serve -a localhost -d --pid-file=hg.pid -E errors.log -v $@ \
22 $ echo '[web]' > .hg/hgrc
6 | sed -e "s/:$HGPORT1\\([^0-9]\\)/:HGPORT1\1/g" \
23 $ echo 'accesslog = access.log' >> .hg/hgrc
7 -e "s/:$HGPORT2\\([^0-9]\\)/:HGPORT2\1/g" \
24 $ echo "port = $HGPORT1" >> .hg/hgrc
8 -e 's/http:\/\/[^/]*\//http:\/\/localhost\//'
25
9 cat hg.pid >> "$DAEMON_PIDS"
26 Without -v
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
27
21 hg init test
28 $ hg serve -a localhost -p $HGPORT -d --pid-file=hg.pid -E errors.log
22 cd test
29 $ cat hg.pid >> "$DAEMON_PIDS"
30 $ if [ -f access.log ]; then
31 $ echo 'access log created - .hg/hgrc respected'
32 access log created - .hg/hgrc respected
33 $ fi
23
34
24 echo '[web]' > .hg/hgrc
35 errors
25 echo 'accesslog = access.log' >> .hg/hgrc
36
26 echo "port = $HGPORT1" >> .hg/hgrc
37 $ cat errors.log
38
39 With -v
27
40
28 echo % Without -v
41 $ hgserve
29 hg serve -a localhost -p $HGPORT -d --pid-file=hg.pid -E errors.log
42 listening at http://localhost/ (bound to 127.0.0.1:HGPORT1)
30 cat hg.pid >> "$DAEMON_PIDS"
43 % errors
31 if [ -f access.log ]; then
44
32 echo 'access log created - .hg/hgrc respected'
45 With -v and -p HGPORT2
33 fi
46
34 echo % errors
47 $ hgserve -p "$HGPORT2"
35 cat errors.log
48 listening at http://localhost/ (bound to 127.0.0.1:HGPORT2)
49 % errors
36
50
37 echo % With -v
51 With -v and -p daytime (should fail because low port)
38 hgserve
39
52
40 echo % With -v and -p HGPORT2
53 $ KILLQUIETLY=Y
41 hgserve -p "$HGPORT2"
54 $ hgserve -p daytime
55 abort: cannot start server at 'localhost:13': Permission denied
56 abort: child process failed to start
57 % errors
58 $ KILLQUIETLY=N
59
60 With --prefix foo
42
61
43 echo '% With -v and -p daytime (should fail because low port)'
62 $ hgserve --prefix foo
44 KILLQUIETLY=Y
63 listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
45 hgserve -p daytime
64 % errors
46 KILLQUIETLY=N
47
65
48 echo % With --prefix foo
66 With --prefix /foo
49 hgserve --prefix foo
67
68 $ hgserve --prefix /foo
69 listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
70 % errors
50
71
51 echo % With --prefix /foo
72 With --prefix foo/
52 hgserve --prefix /foo
73
74 $ hgserve --prefix foo/
75 listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
76 % errors
53
77
54 echo % With --prefix foo/
78 With --prefix /foo/
55 hgserve --prefix foo/
56
79
57 echo % With --prefix /foo/
80 $ hgserve --prefix /foo/
58 hgserve --prefix /foo/
81 listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
82 % errors
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now