Show More
@@ -1,112 +1,119 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 | With -v and -p daytime (should fail because low port) | |
|
47 | With -v and -p daytime | |
|
48 | 48 | |
|
49 | #if no-root no-windows | |
|
49 | # On some system this will fails because port < 1024 are not bindable by normal | |
|
50 | # users. | |
|
51 | # | |
|
52 | # On some others the kernel is configured to allow any user to bind them and | |
|
53 | # this will work fine | |
|
54 | ||
|
55 | #if no-windows | |
|
50 | 56 |
$ |
|
51 | 57 |
$ |
|
52 | abort: cannot start server at 'localhost:13': Permission denied | |
|
53 | abort: child process failed to start | |
|
58 | abort: cannot start server at 'localhost:13': Permission denied (?) | |
|
59 | abort: child process failed to start (?) | |
|
60 | listening at http://localhost/ (bound to $LOCALIP:13) (?) | |
|
54 | 61 | % errors |
|
55 | 62 | $ KILLQUIETLY=N |
|
56 | 63 | #endif |
|
57 | 64 | |
|
58 | 65 | With --prefix foo |
|
59 | 66 | |
|
60 | 67 | $ hgserve --prefix foo |
|
61 | 68 | listening at http://localhost/foo/ (bound to *$LOCALIP*:HGPORT1) (glob) (?) |
|
62 | 69 | % errors |
|
63 | 70 | |
|
64 | 71 | With --prefix /foo |
|
65 | 72 | |
|
66 | 73 | $ hgserve --prefix /foo |
|
67 | 74 | listening at http://localhost/foo/ (bound to *$LOCALIP*:HGPORT1) (glob) (?) |
|
68 | 75 | % errors |
|
69 | 76 | |
|
70 | 77 | With --prefix foo/ |
|
71 | 78 | |
|
72 | 79 | $ hgserve --prefix foo/ |
|
73 | 80 | listening at http://localhost/foo/ (bound to *$LOCALIP*:HGPORT1) (glob) (?) |
|
74 | 81 | % errors |
|
75 | 82 | |
|
76 | 83 | With --prefix /foo/ |
|
77 | 84 | |
|
78 | 85 | $ hgserve --prefix /foo/ |
|
79 | 86 | listening at http://localhost/foo/ (bound to *$LOCALIP*:HGPORT1) (glob) (?) |
|
80 | 87 | % errors |
|
81 | 88 | |
|
82 | 89 | $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS |
|
83 | 90 | |
|
84 | 91 | With out of bounds accesses |
|
85 | 92 | |
|
86 | 93 | $ rm access.log |
|
87 | 94 | $ hg serve -a localhost -p $HGPORT -d --prefix some/dir \ |
|
88 | 95 | > --pid-file=hg.pid -E errors.log |
|
89 | 96 | $ cat hg.pid >> "$DAEMON_PIDS" |
|
90 | 97 | |
|
91 | 98 | $ hg id http://localhost:$HGPORT/some/dir7 |
|
92 | 99 | abort: HTTP Error 404: Not Found |
|
93 | 100 | [100] |
|
94 | 101 | $ hg id http://localhost:$HGPORT/some |
|
95 | 102 | abort: HTTP Error 404: Not Found |
|
96 | 103 | [100] |
|
97 | 104 | |
|
98 | 105 | $ cat access.log errors.log |
|
99 | 106 | $LOCALIP - - [$LOGDATE$] "GET /some/dir7?cmd=capabilities HTTP/1.1" 404 - (glob) |
|
100 | 107 | $LOCALIP - - [$LOGDATE$] "GET /some?cmd=capabilities HTTP/1.1" 404 - (glob) |
|
101 | 108 | |
|
102 | 109 | $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS |
|
103 | 110 | |
|
104 | 111 | issue6362: Previously, this crashed on Python 3 |
|
105 | 112 | |
|
106 | 113 | $ hg serve -a 0.0.0.0 -d --pid-file=hg.pid |
|
107 | 114 | listening at http://*:$HGPORT1/ (bound to *:$HGPORT1) (glob) (?) |
|
108 | 115 | |
|
109 | 116 | $ cat hg.pid > "$DAEMON_PIDS" |
|
110 | 117 | $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS |
|
111 | 118 | |
|
112 | 119 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now