##// END OF EJS Templates
tests: unify test-newercgi
Matt Mackall -
r12471:d86dc8b1 default
parent child Browse files
Show More
@@ -1,84 +1,88 b''
1 #!/bin/sh
1 This is a rudimentary test of the CGI files as of d74fc8dec2b4.
2 # This is a rudimentary test of the CGI files as of d74fc8dec2b4.
3
2
4 hg init test
3 $ hg init test
5
4
6 cat >hgweb.cgi <<HGWEB
5 $ cat >hgweb.cgi <<HGWEB
7 #!/usr/bin/env python
6 > #!/usr/bin/env python
8 #
7 > #
9 # An example CGI script to use hgweb, edit as necessary
8 > # An example CGI script to use hgweb, edit as necessary
10
9 >
11 import cgitb
10 > import cgitb
12 cgitb.enable()
11 > cgitb.enable()
13
12 >
14 from mercurial import demandimport; demandimport.enable()
13 > from mercurial import demandimport; demandimport.enable()
15 from mercurial.hgweb import hgweb
14 > from mercurial.hgweb import hgweb
16 from mercurial.hgweb import wsgicgi
15 > from mercurial.hgweb import wsgicgi
16 >
17 > application = hgweb("test", "Empty test repository")
18 > wsgicgi.launch(application)
19 > HGWEB
17
20
18 application = hgweb("test", "Empty test repository")
21 $ chmod 755 hgweb.cgi
19 wsgicgi.launch(application)
20 HGWEB
21 chmod 755 hgweb.cgi
22
22
23 cat >hgweb.config <<HGWEBDIRCONF
23 $ cat >hgweb.config <<HGWEBDIRCONF
24 [paths]
24 > [paths]
25 test = test
25 > test = test
26 HGWEBDIRCONF
26 > HGWEBDIRCONF
27
27
28 cat >hgwebdir.cgi <<HGWEBDIR
28 $ cat >hgwebdir.cgi <<HGWEBDIR
29 #!/usr/bin/env python
29 > #!/usr/bin/env python
30 #
30 > #
31 # An example CGI script to export multiple hgweb repos, edit as necessary
31 > # An example CGI script to export multiple hgweb repos, edit as necessary
32
32 >
33 import cgitb
33 > import cgitb
34 cgitb.enable()
34 > cgitb.enable()
35
35 >
36 from mercurial import demandimport; demandimport.enable()
36 > from mercurial import demandimport; demandimport.enable()
37 from mercurial.hgweb import hgwebdir
37 > from mercurial.hgweb import hgwebdir
38 from mercurial.hgweb import wsgicgi
38 > from mercurial.hgweb import wsgicgi
39 >
40 > application = hgwebdir("hgweb.config")
41 > wsgicgi.launch(application)
42 > HGWEBDIR
39
43
40 application = hgwebdir("hgweb.config")
44 $ chmod 755 hgwebdir.cgi
41 wsgicgi.launch(application)
42 HGWEBDIR
43 chmod 755 hgwebdir.cgi
44
45
45 DOCUMENT_ROOT="/var/www/hg"; export DOCUMENT_ROOT
46 $ DOCUMENT_ROOT="/var/www/hg"; export DOCUMENT_ROOT
46 GATEWAY_INTERFACE="CGI/1.1"; export GATEWAY_INTERFACE
47 $ GATEWAY_INTERFACE="CGI/1.1"; export GATEWAY_INTERFACE
47 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
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
48 HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"; export HTTP_ACCEPT_CHARSET
49 $ HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"; export HTTP_ACCEPT_CHARSET
49 HTTP_ACCEPT_ENCODING="gzip,deflate"; export HTTP_ACCEPT_ENCODING
50 $ HTTP_ACCEPT_ENCODING="gzip,deflate"; export HTTP_ACCEPT_ENCODING
50 HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"; export HTTP_ACCEPT_LANGUAGE
51 $ HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"; export HTTP_ACCEPT_LANGUAGE
51 HTTP_CACHE_CONTROL="max-age=0"; export HTTP_CACHE_CONTROL
52 $ HTTP_CACHE_CONTROL="max-age=0"; export HTTP_CACHE_CONTROL
52 HTTP_CONNECTION="keep-alive"; export HTTP_CONNECTION
53 $ HTTP_CONNECTION="keep-alive"; export HTTP_CONNECTION
53 HTTP_HOST="hg.omnifarious.org"; export HTTP_HOST
54 $ HTTP_HOST="hg.omnifarious.org"; export HTTP_HOST
54 HTTP_KEEP_ALIVE="300"; export HTTP_KEEP_ALIVE
55 $ HTTP_KEEP_ALIVE="300"; export HTTP_KEEP_ALIVE
55 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
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
56 PATH_INFO="/"; export PATH_INFO
57 $ PATH_INFO="/"; export PATH_INFO
57 PATH_TRANSLATED="/var/www/hg/index.html"; export PATH_TRANSLATED
58 $ PATH_TRANSLATED="/var/www/hg/index.html"; export PATH_TRANSLATED
58 QUERY_STRING=""; export QUERY_STRING
59 $ QUERY_STRING=""; export QUERY_STRING
59 REMOTE_ADDR="127.0.0.2"; export REMOTE_ADDR
60 $ REMOTE_ADDR="127.0.0.2"; export REMOTE_ADDR
60 REMOTE_PORT="44703"; export REMOTE_PORT
61 $ REMOTE_PORT="44703"; export REMOTE_PORT
61 REQUEST_METHOD="GET"; export REQUEST_METHOD
62 $ REQUEST_METHOD="GET"; export REQUEST_METHOD
62 REQUEST_URI="/test/"; export REQUEST_URI
63 $ REQUEST_URI="/test/"; export REQUEST_URI
63 SCRIPT_FILENAME="/home/hopper/hg_public/test.cgi"; export SCRIPT_FILENAME
64 $ SCRIPT_FILENAME="/home/hopper/hg_public/test.cgi"; export SCRIPT_FILENAME
64 SCRIPT_NAME="/test"; export SCRIPT_NAME
65 $ SCRIPT_NAME="/test"; export SCRIPT_NAME
65 SCRIPT_URI="http://hg.omnifarious.org/test/"; export SCRIPT_URI
66 $ SCRIPT_URI="http://hg.omnifarious.org/test/"; export SCRIPT_URI
66 SCRIPT_URL="/test/"; export SCRIPT_URL
67 $ SCRIPT_URL="/test/"; export SCRIPT_URL
67 SERVER_ADDR="127.0.0.1"; export SERVER_ADDR
68 $ SERVER_ADDR="127.0.0.1"; export SERVER_ADDR
68 SERVER_ADMIN="eric@localhost"; export SERVER_ADMIN
69 $ SERVER_ADMIN="eric@localhost"; export SERVER_ADMIN
69 SERVER_NAME="hg.omnifarious.org"; export SERVER_NAME
70 $ SERVER_NAME="hg.omnifarious.org"; export SERVER_NAME
70 SERVER_PORT="80"; export SERVER_PORT
71 $ SERVER_PORT="80"; export SERVER_PORT
71 SERVER_PROTOCOL="HTTP/1.1"; export SERVER_PROTOCOL
72 $ SERVER_PROTOCOL="HTTP/1.1"; export SERVER_PROTOCOL
72 SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>\; export SERVER_SIGNATURE
73 $ SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>"; export SERVER_SIGNATURE
73 "
74 $ SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE
74 SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE
75
75 python hgweb.cgi >page1 2>&1 ; echo $?
76 $ python hgweb.cgi > page1
76 python hgwebdir.cgi >page2 2>&1 ; echo $?
77 $ python hgwebdir.cgi > page2
77 PATH_INFO="/test/"
78
78 PATH_TRANSLATED="/var/something/test.cgi"
79 $ PATH_INFO="/test/"
79 REQUEST_URI="/test/test/"
80 $ PATH_TRANSLATED="/var/something/test.cgi"
80 SCRIPT_URI="http://hg.omnifarious.org/test/test/"
81 $ REQUEST_URI="/test/test/"
81 SCRIPT_URL="/test/test/"
82 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
82 python hgwebdir.cgi >page3 2>&1 ; echo $?
83 $ SCRIPT_URL="/test/test/"
83 fgrep -i error page1 page2 page3 && exit 1
84
84 exit 0
85 $ python hgwebdir.cgi > page3
86
87 $ grep -i error page1 page2 page3
88 [1]
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