annotate tests/test-newercgi.t @ 13143:c2e55c21db27

archive: add support for progress extension
author Martin Geisler <mg@aragost.com>
date Mon, 29 Nov 2010 16:17:05 +0100
parents d86dc8b1ffc3
children aa3f726a2bdb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12471
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
1 This is a rudimentary test of the CGI files as of d74fc8dec2b4.
5577
e0173902c813 CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
2
12471
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
3 $ hg init test
5577
e0173902c813 CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
4
12471
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
5 $ cat >hgweb.cgi <<HGWEB
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
6 > #!/usr/bin/env python
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
7 > #
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
8 > # An example CGI script to use hgweb, edit as necessary
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
9 >
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
10 > import cgitb
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
11 > cgitb.enable()
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
12 >
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
13 > from mercurial import demandimport; demandimport.enable()
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
14 > from mercurial.hgweb import hgweb
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
15 > from mercurial.hgweb import wsgicgi
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
16 >
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
17 > application = hgweb("test", "Empty test repository")
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
18 > wsgicgi.launch(application)
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
19 > HGWEB
5577
e0173902c813 CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
20
12471
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
21 $ chmod 755 hgweb.cgi
5577
e0173902c813 CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
22
12471
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
23 $ cat >hgweb.config <<HGWEBDIRCONF
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
24 > [paths]
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
25 > test = test
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
26 > HGWEBDIRCONF
5577
e0173902c813 CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
27
12471
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
28 $ cat >hgwebdir.cgi <<HGWEBDIR
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
29 > #!/usr/bin/env python
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
30 > #
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
31 > # An example CGI script to export multiple hgweb repos, edit as necessary
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
32 >
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
33 > import cgitb
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
34 > cgitb.enable()
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
35 >
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
36 > from mercurial import demandimport; demandimport.enable()
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
37 > from mercurial.hgweb import hgwebdir
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
38 > from mercurial.hgweb import wsgicgi
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
39 >
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
40 > application = hgwebdir("hgweb.config")
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
41 > wsgicgi.launch(application)
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
42 > HGWEBDIR
5577
e0173902c813 CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
43
12471
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
44 $ chmod 755 hgwebdir.cgi
5577
e0173902c813 CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
45
12471
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
46 $ DOCUMENT_ROOT="/var/www/hg"; export DOCUMENT_ROOT
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
47 $ GATEWAY_INTERFACE="CGI/1.1"; export GATEWAY_INTERFACE
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
48 $ HTTP_ACCEPT="text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; export HTTP_ACCEPT
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
49 $ HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"; export HTTP_ACCEPT_CHARSET
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
50 $ HTTP_ACCEPT_ENCODING="gzip,deflate"; export HTTP_ACCEPT_ENCODING
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
51 $ HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"; export HTTP_ACCEPT_LANGUAGE
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
52 $ HTTP_CACHE_CONTROL="max-age=0"; export HTTP_CACHE_CONTROL
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
53 $ HTTP_CONNECTION="keep-alive"; export HTTP_CONNECTION
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
54 $ HTTP_HOST="hg.omnifarious.org"; export HTTP_HOST
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
55 $ HTTP_KEEP_ALIVE="300"; export HTTP_KEEP_ALIVE
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
56 $ HTTP_USER_AGENT="Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.4) Gecko/20060608 Ubuntu/dapper-security Firefox/1.5.0.4"; export HTTP_USER_AGENT
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
57 $ PATH_INFO="/"; export PATH_INFO
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
58 $ PATH_TRANSLATED="/var/www/hg/index.html"; export PATH_TRANSLATED
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
59 $ QUERY_STRING=""; export QUERY_STRING
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
60 $ REMOTE_ADDR="127.0.0.2"; export REMOTE_ADDR
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
61 $ REMOTE_PORT="44703"; export REMOTE_PORT
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
62 $ REQUEST_METHOD="GET"; export REQUEST_METHOD
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
63 $ REQUEST_URI="/test/"; export REQUEST_URI
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
64 $ SCRIPT_FILENAME="/home/hopper/hg_public/test.cgi"; export SCRIPT_FILENAME
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
65 $ SCRIPT_NAME="/test"; export SCRIPT_NAME
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
66 $ SCRIPT_URI="http://hg.omnifarious.org/test/"; export SCRIPT_URI
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
67 $ SCRIPT_URL="/test/"; export SCRIPT_URL
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
68 $ SERVER_ADDR="127.0.0.1"; export SERVER_ADDR
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
69 $ SERVER_ADMIN="eric@localhost"; export SERVER_ADMIN
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
70 $ SERVER_NAME="hg.omnifarious.org"; export SERVER_NAME
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
71 $ SERVER_PORT="80"; export SERVER_PORT
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
72 $ SERVER_PROTOCOL="HTTP/1.1"; export SERVER_PROTOCOL
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
73 $ SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>"; export SERVER_SIGNATURE
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
74 $ SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
75
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
76 $ python hgweb.cgi > page1
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
77 $ python hgwebdir.cgi > page2
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
78
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
79 $ PATH_INFO="/test/"
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
80 $ PATH_TRANSLATED="/var/something/test.cgi"
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
81 $ REQUEST_URI="/test/test/"
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
82 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
83 $ SCRIPT_URL="/test/test/"
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
84
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
85 $ python hgwebdir.cgi > page3
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
86
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
87 $ grep -i error page1 page2 page3
d86dc8b1ffc3 tests: unify test-newercgi
Matt Mackall <mpm@selenic.com>
parents: 5580
diff changeset
88 [1]