comparison tests/test-newcgi @ 6042:2da5b19a6460

Merge with crew
author Bryan O'Sullivan <bos@serpentine.com>
date Wed, 06 Feb 2008 19:57:52 -0800
parents f429e0e067a8
children
comparison
equal deleted inserted replaced
6041:dd714452c26e 6042:2da5b19a6460
1 #!/bin/sh
2 # This tests if CGI files from after d0db3462d568 but
3 # before d74fc8dec2b4 still work.
4
5 hg init test
6
7 cat >hgweb.cgi <<HGWEB
8 #!/usr/bin/env python
9 #
10 # An example CGI script to use hgweb, edit as necessary
11
12 import cgitb
13 cgitb.enable()
14
15 from mercurial import demandimport; demandimport.enable()
16 from mercurial.hgweb import hgweb
17 from mercurial.hgweb import wsgicgi
18 from mercurial.hgweb.request import wsgiapplication
19
20 def make_web_app():
21 return hgweb("test", "Empty test repository")
22
23 wsgicgi.launch(wsgiapplication(make_web_app))
24 HGWEB
25 chmod 755 hgweb.cgi
26
27 cat >hgweb.config <<HGWEBDIRCONF
28 [paths]
29 test = test
30 HGWEBDIRCONF
31
32 cat >hgwebdir.cgi <<HGWEBDIR
33 #!/usr/bin/env python
34 #
35 # An example CGI script to export multiple hgweb repos, edit as necessary
36
37 import cgitb
38 cgitb.enable()
39
40 from mercurial import demandimport; demandimport.enable()
41 from mercurial.hgweb import hgwebdir
42 from mercurial.hgweb import wsgicgi
43 from mercurial.hgweb.request import wsgiapplication
44
45 def make_web_app():
46 return hgwebdir("hgweb.config")
47
48 wsgicgi.launch(wsgiapplication(make_web_app))
49 HGWEBDIR
50 chmod 755 hgwebdir.cgi
51
52 DOCUMENT_ROOT="/var/www/hg"; export DOCUMENT_ROOT
53 GATEWAY_INTERFACE="CGI/1.1"; export GATEWAY_INTERFACE
54 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
55 HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"; export HTTP_ACCEPT_CHARSET
56 HTTP_ACCEPT_ENCODING="gzip,deflate"; export HTTP_ACCEPT_ENCODING
57 HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"; export HTTP_ACCEPT_LANGUAGE
58 HTTP_CACHE_CONTROL="max-age=0"; export HTTP_CACHE_CONTROL
59 HTTP_CONNECTION="keep-alive"; export HTTP_CONNECTION
60 HTTP_HOST="hg.omnifarious.org"; export HTTP_HOST
61 HTTP_KEEP_ALIVE="300"; export HTTP_KEEP_ALIVE
62 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
63 PATH_INFO="/"; export PATH_INFO
64 PATH_TRANSLATED="/var/www/hg/index.html"; export PATH_TRANSLATED
65 QUERY_STRING=""; export QUERY_STRING
66 REMOTE_ADDR="127.0.0.2"; export REMOTE_ADDR
67 REMOTE_PORT="44703"; export REMOTE_PORT
68 REQUEST_METHOD="GET"; export REQUEST_METHOD
69 REQUEST_URI="/test/"; export REQUEST_URI
70 SCRIPT_FILENAME="/home/hopper/hg_public/test.cgi"; export SCRIPT_FILENAME
71 SCRIPT_NAME="/test"; export SCRIPT_NAME
72 SCRIPT_URI="http://hg.omnifarious.org/test/"; export SCRIPT_URI
73 SCRIPT_URL="/test/"; export SCRIPT_URL
74 SERVER_ADDR="127.0.0.1"; export SERVER_ADDR
75 SERVER_ADMIN="eric@localhost"; export SERVER_ADMIN
76 SERVER_NAME="hg.omnifarious.org"; export SERVER_NAME
77 SERVER_PORT="80"; export SERVER_PORT
78 SERVER_PROTOCOL="HTTP/1.1"; export SERVER_PROTOCOL
79 SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>\; export SERVER_SIGNATURE
80 "
81 SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE
82 python hgweb.cgi >page1 2>&1 ; echo $?
83 python hgwebdir.cgi >page2 2>&1 ; echo $?
84 PATH_INFO="/test/"
85 PATH_TRANSLATED="/var/something/test.cgi"
86 REQUEST_URI="/test/test/"
87 SCRIPT_URI="http://hg.omnifarious.org/test/test/"
88 SCRIPT_URL="/test/test/"
89 python hgwebdir.cgi >page3 2>&1 ; echo $?
90 fgrep -i error page1 page2 page3 && exit 1
91 exit 0