Show More
@@ -1,109 +1,112 b'' | |||
|
1 | 1 | #require serve |
|
2 | 2 | |
|
3 | 3 | $ hgserve() |
|
4 | 4 | > { |
|
5 | 5 | > hg serve -a localhost -d --pid-file=hg.pid -E errors.log -v $@ \ |
|
6 | 6 | > | sed -e "s/:$HGPORT1\\([^0-9]\\)/:HGPORT1\1/g" \ |
|
7 | 7 | > -e "s/:$HGPORT2\\([^0-9]\\)/:HGPORT2\1/g" \ |
|
8 | 8 | > -e 's/http:\/\/[^/]*\//http:\/\/localhost\//' |
|
9 | 9 | > if [ -f hg.pid ]; then |
|
10 | 10 | > killdaemons.py hg.pid |
|
11 | 11 | > fi |
|
12 | 12 | > echo % errors |
|
13 | 13 | > cat errors.log |
|
14 | 14 | > } |
|
15 | 15 | |
|
16 | 16 | $ hg init test |
|
17 | 17 | $ cd test |
|
18 | 18 | $ echo '[web]' > .hg/hgrc |
|
19 | 19 | $ echo 'accesslog = access.log' >> .hg/hgrc |
|
20 | 20 | $ echo "port = $HGPORT1" >> .hg/hgrc |
|
21 | 21 | |
|
22 | 22 | Without -v |
|
23 | 23 | |
|
24 | 24 | $ hg serve -a localhost -p $HGPORT -d --pid-file=hg.pid -E errors.log |
|
25 | 25 | $ cat hg.pid >> "$DAEMON_PIDS" |
|
26 | 26 | $ if [ -f access.log ]; then |
|
27 | 27 | > echo 'access log created - .hg/hgrc respected' |
|
28 | 28 | > fi |
|
29 | 29 | access log created - .hg/hgrc respected |
|
30 | 30 | |
|
31 | 31 | errors |
|
32 | 32 | |
|
33 | 33 | $ cat errors.log |
|
34 | 34 | |
|
35 | 35 | With -v |
|
36 | 36 | |
|
37 | 37 | $ hgserve |
|
38 | 38 | listening at http://localhost/ (bound to *$LOCALIP*:HGPORT1) (glob) (?) |
|
39 | 39 | % errors |
|
40 | 40 | |
|
41 | 41 | With -v and -p HGPORT2 |
|
42 | 42 | |
|
43 | 43 | $ hgserve -p "$HGPORT2" |
|
44 | 44 | listening at http://localhost/ (bound to *$LOCALIP*:HGPORT2) (glob) (?) |
|
45 | 45 | % errors |
|
46 | 46 | |
|
47 | 47 | With -v and -p daytime (should fail because low port) |
|
48 | 48 | |
|
49 | 49 | #if no-root no-windows |
|
50 | 50 | $ KILLQUIETLY=Y |
|
51 | 51 | $ hgserve -p daytime |
|
52 | 52 | abort: cannot start server at 'localhost:13': Permission denied |
|
53 | 53 | abort: child process failed to start |
|
54 | 54 | % errors |
|
55 | 55 | $ KILLQUIETLY=N |
|
56 | 56 | #endif |
|
57 | 57 | |
|
58 | 58 | With --prefix foo |
|
59 | 59 | |
|
60 | 60 | $ hgserve --prefix foo |
|
61 | 61 | listening at http://localhost/foo/ (bound to *$LOCALIP*:HGPORT1) (glob) (?) |
|
62 | 62 | % errors |
|
63 | 63 | |
|
64 | 64 | With --prefix /foo |
|
65 | 65 | |
|
66 | 66 | $ hgserve --prefix /foo |
|
67 | 67 | listening at http://localhost/foo/ (bound to *$LOCALIP*:HGPORT1) (glob) (?) |
|
68 | 68 | % errors |
|
69 | 69 | |
|
70 | 70 | With --prefix foo/ |
|
71 | 71 | |
|
72 | 72 | $ hgserve --prefix foo/ |
|
73 | 73 | listening at http://localhost/foo/ (bound to *$LOCALIP*:HGPORT1) (glob) (?) |
|
74 | 74 | % errors |
|
75 | 75 | |
|
76 | 76 | With --prefix /foo/ |
|
77 | 77 | |
|
78 | 78 | $ hgserve --prefix /foo/ |
|
79 | 79 | listening at http://localhost/foo/ (bound to *$LOCALIP*:HGPORT1) (glob) (?) |
|
80 | 80 | % errors |
|
81 | 81 | |
|
82 | 82 | $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS |
|
83 | 83 | |
|
84 | 84 | With out of bounds accesses |
|
85 | 85 | |
|
86 | 86 | $ rm access.log |
|
87 | 87 | $ hg serve -a localhost -p $HGPORT -d --prefix some/dir \ |
|
88 | 88 | > --pid-file=hg.pid -E errors.log |
|
89 | 89 | $ cat hg.pid >> "$DAEMON_PIDS" |
|
90 | 90 | |
|
91 | 91 | $ hg id http://localhost:$HGPORT/some/dir7 |
|
92 | 92 | abort: HTTP Error 404: Not Found |
|
93 | 93 | [255] |
|
94 | 94 | $ hg id http://localhost:$HGPORT/some |
|
95 | 95 | abort: HTTP Error 404: Not Found |
|
96 | 96 | [255] |
|
97 | 97 | |
|
98 | 98 | $ cat access.log errors.log |
|
99 | 99 | $LOCALIP - - [$LOGDATE$] "GET /some/dir7?cmd=capabilities HTTP/1.1" 404 - (glob) |
|
100 | 100 | $LOCALIP - - [$LOGDATE$] "GET /some?cmd=capabilities HTTP/1.1" 404 - (glob) |
|
101 | 101 | |
|
102 | 102 | $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS |
|
103 | 103 | |
|
104 | 104 | issue6362: Previously, this crashed on Python 3 |
|
105 | 105 | |
|
106 | $ hg serve -a 0.0.0.0 -d | |
|
107 | listening at http://*:$HGPORT1/ (bound to *:$HGPORT1) (glob) | |
|
106 | $ hg serve -a 0.0.0.0 -d --pid-file=hg.pid | |
|
107 | listening at http://*:$HGPORT1/ (bound to *:$HGPORT1) (glob) (?) | |
|
108 | ||
|
109 | $ cat hg.pid > "$DAEMON_PIDS" | |
|
110 | $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS | |
|
108 | 111 | |
|
109 | 112 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now