##// END OF EJS Templates
tests: add more testing for webdir nesting
Dirkjan Ochtman -
r7202:268c582b default
parent child Browse files
Show More
@@ -1,84 +1,91 b''
1 #!/bin/sh
1 #!/bin/sh
2 # Tests some basic hgwebdir functionality. Tests setting up paths and
2 # Tests some basic hgwebdir functionality. Tests setting up paths and
3 # collection, different forms of 404s and the subdirectory support.
3 # collection, different forms of 404s and the subdirectory support.
4
4
5 mkdir webdir
5 mkdir webdir
6 cd webdir
6 cd webdir
7
7
8 hg init a
8 hg init a
9 echo a > a/a
9 echo a > a/a
10 hg --cwd a ci -Ama -d'1 0'
10 hg --cwd a ci -Ama -d'1 0'
11
11
12 hg init b
12 hg init b
13 echo b > b/b
13 echo b > b/b
14 hg --cwd b ci -Amb -d'2 0'
14 hg --cwd b ci -Amb -d'2 0'
15
15
16 hg init c
16 hg init c
17 echo c > c/c
17 echo c > c/c
18 hg --cwd c ci -Amc -d'3 0'
18 hg --cwd c ci -Amc -d'3 0'
19
20 cd b
21 hg init d
22 echo d > d/d
23 hg --cwd d ci -Amd
24 cd ..
25
19 root=`pwd`
26 root=`pwd`
20
21 cd ..
27 cd ..
22
28
23 cat > paths.conf <<EOF
29 cat > paths.conf <<EOF
24 [paths]
30 [paths]
25 a=$root/a
31 a=$root/a
26 b=$root/b
32 b=$root/b
27 EOF
33 EOF
28
34
29 hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \
35 hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \
30 -A access-paths.log -E error-paths-1.log
36 -A access-paths.log -E error-paths-1.log
31 cat hg.pid >> $DAEMON_PIDS
37 cat hg.pid >> $DAEMON_PIDS
32
38
33 echo % should give a 404 - file does not exist
39 echo % should give a 404 - file does not exist
34 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw'
40 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw'
35
41
36 echo % should succeed
42 echo % should succeed
37 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
43 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
38 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw'
44 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw'
39 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
45 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
40
46
41 echo % should give a 404 - repo is not published
47 echo % should give a 404 - repo is not published
42 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
48 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
43
49
44 cat > paths.conf <<EOF
50 cat > paths.conf <<EOF
45 [paths]
51 [paths]
46 t/a/=$root/a
52 t/a/=$root/a
47 b=$root/b
53 b=$root/b
48 EOF
54 EOF
49
55
50 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
56 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
51 -A access-paths.log -E error-paths-2.log
57 -A access-paths.log -E error-paths-2.log
52 cat hg.pid >> $DAEMON_PIDS
58 cat hg.pid >> $DAEMON_PIDS
53
59
54 echo % should succeed, slashy names
60 echo % should succeed, slashy names
55 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
61 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
56 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw'
62 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw'
57 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
63 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
58 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \
64 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \
59 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
65 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
60 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \
66 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \
61 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
67 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
62 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw'
68 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw'
63
69
64 cat > collections.conf <<EOF
70 cat > collections.conf <<EOF
65 [collections]
71 [collections]
66 $root=$root
72 $root=$root
67 EOF
73 EOF
68
74
69 hg serve -p $HGPORT2 -d --pid-file=hg.pid --webdir-conf collections.conf \
75 hg serve -p $HGPORT2 -d --pid-file=hg.pid --webdir-conf collections.conf \
70 -A access-collections.log -E error-collections.log
76 -A access-collections.log -E error-collections.log
71 cat hg.pid >> $DAEMON_PIDS
77 cat hg.pid >> $DAEMON_PIDS
72
78
73 echo % should succeed
79 echo % should succeed
74 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw'
80 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw'
75 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw'
81 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw'
76 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw'
82 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw'
77 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw'
83 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw'
84 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/d/rev/tip/?style=raw'
78
85
79 echo % paths errors 1
86 echo % paths errors 1
80 cat error-paths-1.log
87 cat error-paths-1.log
81 echo % paths errors 2
88 echo % paths errors 2
82 cat error-paths-2.log
89 cat error-paths-2.log
83 echo % collections errors
90 echo % collections errors
84 cat error-collections.log
91 cat error-collections.log
@@ -1,124 +1,141 b''
1 adding a
1 adding a
2 adding b
2 adding b
3 adding c
3 adding c
4 adding d
4 % should give a 404 - file does not exist
5 % should give a 404 - file does not exist
5 404 Not Found
6 404 Not Found
6
7
7
8
8 error: bork@8580ff50825a: not found in manifest
9 error: bork@8580ff50825a: not found in manifest
9 % should succeed
10 % should succeed
10 200 Script output follows
11 200 Script output follows
11
12
12
13
13 /a/
14 /a/
14 /b/
15 /b/
15
16
16 200 Script output follows
17 200 Script output follows
17
18
18 a
19 a
19 200 Script output follows
20 200 Script output follows
20
21
21 b
22 b
22 % should give a 404 - repo is not published
23 % should give a 404 - repo is not published
23 404 Not Found
24 404 Not Found
24
25
25
26
26 error: repository c not found
27 error: repository c not found
27 % should succeed, slashy names
28 % should succeed, slashy names
28 200 Script output follows
29 200 Script output follows
29
30
30
31
31 /b/
32 /b/
32 /t/a/
33 /t/a/
33
34
34 200 Script output follows
35 200 Script output follows
35
36
36
37
37 /t/a/
38 /t/a/
38
39
39 200 Script output follows
40 200 Script output follows
40
41
41
42
42 /t/a/
43 /t/a/
43
44
44 200 Script output follows
45 200 Script output follows
45
46
46 <?xml version="1.0" encoding="ascii"?>
47 <?xml version="1.0" encoding="ascii"?>
47 <feed xmlns="http://127.0.0.1/2005/Atom">
48 <feed xmlns="http://127.0.0.1/2005/Atom">
48 <!-- Changelog -->
49 <!-- Changelog -->
49 <id>http://127.0.0.1/t/a/</id>
50 <id>http://127.0.0.1/t/a/</id>
50 <link rel="self" href="http://127.0.0.1/t/a/atom-log"/>
51 <link rel="self" href="http://127.0.0.1/t/a/atom-log"/>
51 <link rel="alternate" href="http://127.0.0.1/t/a/"/>
52 <link rel="alternate" href="http://127.0.0.1/t/a/"/>
52 <title>t/a Changelog</title>
53 <title>t/a Changelog</title>
53 <updated>1970-01-01T00:00:01+00:00</updated>
54 <updated>1970-01-01T00:00:01+00:00</updated>
54
55
55 <entry>
56 <entry>
56 <title>a</title>
57 <title>a</title>
57 <id>http://127.0.0.1/mercurial/#changeset-8580ff50825a50c8f716709acdf8de0deddcd6ab</id>
58 <id>http://127.0.0.1/mercurial/#changeset-8580ff50825a50c8f716709acdf8de0deddcd6ab</id>
58 <link href="http://127.0.0.1/t/a/rev/8580ff50825a50c8f716709acdf8de0deddcd6ab"/>
59 <link href="http://127.0.0.1/t/a/rev/8580ff50825a50c8f716709acdf8de0deddcd6ab"/>
59 <author>
60 <author>
60 <name>test</name>
61 <name>test</name>
61 <email>&#116;&#101;&#115;&#116;</email>
62 <email>&#116;&#101;&#115;&#116;</email>
62 </author>
63 </author>
63 <updated>1970-01-01T00:00:01+00:00</updated>
64 <updated>1970-01-01T00:00:01+00:00</updated>
64 <published>1970-01-01T00:00:01+00:00</published>
65 <published>1970-01-01T00:00:01+00:00</published>
65 <content type="xhtml">
66 <content type="xhtml">
66 <div xmlns="http://127.0.0.1/1999/xhtml">
67 <div xmlns="http://127.0.0.1/1999/xhtml">
67 <pre xml:space="preserve">a</pre>
68 <pre xml:space="preserve">a</pre>
68 </div>
69 </div>
69 </content>
70 </content>
70 </entry>
71 </entry>
71
72
72 </feed>
73 </feed>
73 200 Script output follows
74 200 Script output follows
74
75
75 <?xml version="1.0" encoding="ascii"?>
76 <?xml version="1.0" encoding="ascii"?>
76 <feed xmlns="http://127.0.0.1/2005/Atom">
77 <feed xmlns="http://127.0.0.1/2005/Atom">
77 <!-- Changelog -->
78 <!-- Changelog -->
78 <id>http://127.0.0.1/t/a/</id>
79 <id>http://127.0.0.1/t/a/</id>
79 <link rel="self" href="http://127.0.0.1/t/a/atom-log"/>
80 <link rel="self" href="http://127.0.0.1/t/a/atom-log"/>
80 <link rel="alternate" href="http://127.0.0.1/t/a/"/>
81 <link rel="alternate" href="http://127.0.0.1/t/a/"/>
81 <title>t/a Changelog</title>
82 <title>t/a Changelog</title>
82 <updated>1970-01-01T00:00:01+00:00</updated>
83 <updated>1970-01-01T00:00:01+00:00</updated>
83
84
84 <entry>
85 <entry>
85 <title>a</title>
86 <title>a</title>
86 <id>http://127.0.0.1/mercurial/#changeset-8580ff50825a50c8f716709acdf8de0deddcd6ab</id>
87 <id>http://127.0.0.1/mercurial/#changeset-8580ff50825a50c8f716709acdf8de0deddcd6ab</id>
87 <link href="http://127.0.0.1/t/a/rev/8580ff50825a50c8f716709acdf8de0deddcd6ab"/>
88 <link href="http://127.0.0.1/t/a/rev/8580ff50825a50c8f716709acdf8de0deddcd6ab"/>
88 <author>
89 <author>
89 <name>test</name>
90 <name>test</name>
90 <email>&#116;&#101;&#115;&#116;</email>
91 <email>&#116;&#101;&#115;&#116;</email>
91 </author>
92 </author>
92 <updated>1970-01-01T00:00:01+00:00</updated>
93 <updated>1970-01-01T00:00:01+00:00</updated>
93 <published>1970-01-01T00:00:01+00:00</published>
94 <published>1970-01-01T00:00:01+00:00</published>
94 <content type="xhtml">
95 <content type="xhtml">
95 <div xmlns="http://127.0.0.1/1999/xhtml">
96 <div xmlns="http://127.0.0.1/1999/xhtml">
96 <pre xml:space="preserve">a</pre>
97 <pre xml:space="preserve">a</pre>
97 </div>
98 </div>
98 </content>
99 </content>
99 </entry>
100 </entry>
100
101
101 </feed>
102 </feed>
102 200 Script output follows
103 200 Script output follows
103
104
104 a
105 a
105 % should succeed
106 % should succeed
106 200 Script output follows
107 200 Script output follows
107
108
108
109
109 /a/
110 /a/
110 /b/
111 /b/
112 /b/d/
111 /c/
113 /c/
112
114
113 200 Script output follows
115 200 Script output follows
114
116
115 a
117 a
116 200 Script output follows
118 200 Script output follows
117
119
118 b
120 b
119 200 Script output follows
121 200 Script output follows
120
122
121 c
123 c
124 200 Script output follows
125
126
127 # HG changeset patch
128 # User test
129 # Date 0 0
130 # Node ID 43cb50608b2ae8635a62e2e8730adefc32a274ee
131
132 d
133
134 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
135 +++ b/d Thu Jan 01 00:00:00 1970 +0000
136 @@ -0,0 +1,1 @@
137 +d
138
122 % paths errors 1
139 % paths errors 1
123 % paths errors 2
140 % paths errors 2
124 % collections errors
141 % collections errors
General Comments 0
You need to be logged in to leave comments. Login now