##// END OF EJS Templates
tests: unify test-clone-cgi
Matt Mackall -
r12410:2bfb335c default
parent child Browse files
Show More
@@ -1,62 +1,56 b''
1 #!/bin/sh
1 This is a test of the wire protocol over CGI-based hgweb.
2 # This is a test of the wire protocol over CGI-based hgweb.
2 initialize repository
3
4 echo % initialize repository
5 hg init test
6 cd test
7 echo a > a
8 hg ci -Ama
9 cd ..
10
11 cat >hgweb.cgi <<HGWEB
12 #!/usr/bin/env python
13 #
14 # An example CGI script to use hgweb, edit as necessary
15
16 import cgitb
17 cgitb.enable()
18
19 from mercurial import demandimport; demandimport.enable()
20 from mercurial.hgweb import hgweb
21 from mercurial.hgweb import wsgicgi
22
23 application = hgweb("test", "Empty test repository")
24 wsgicgi.launch(application)
25 HGWEB
26 chmod 755 hgweb.cgi
27
3
28 DOCUMENT_ROOT="/var/www/hg"; export DOCUMENT_ROOT
4 $ hg init test
29 GATEWAY_INTERFACE="CGI/1.1"; export GATEWAY_INTERFACE
5 $ cd test
30 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
6 $ echo a > a
31 HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"; export HTTP_ACCEPT_CHARSET
7 $ hg ci -Ama
32 HTTP_ACCEPT_ENCODING="gzip,deflate"; export HTTP_ACCEPT_ENCODING
8 adding a
33 HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"; export HTTP_ACCEPT_LANGUAGE
9 $ cd ..
34 HTTP_CACHE_CONTROL="max-age=0"; export HTTP_CACHE_CONTROL
10 $ cat >hgweb.cgi <<HGWEB
35 HTTP_CONNECTION="keep-alive"; export HTTP_CONNECTION
11 > #
36 HTTP_HOST="hg.omnifarious.org"; export HTTP_HOST
12 > # An example CGI script to use hgweb, edit as necessary
37 HTTP_KEEP_ALIVE="300"; export HTTP_KEEP_ALIVE
13 > import cgitb
38 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
14 > cgitb.enable()
39 PATH_INFO="/"; export PATH_INFO
15 > from mercurial import demandimport; demandimport.enable()
40 PATH_TRANSLATED="/var/www/hg/index.html"; export PATH_TRANSLATED
16 > from mercurial.hgweb import hgweb
41 REMOTE_ADDR="127.0.0.2"; export REMOTE_ADDR
17 > from mercurial.hgweb import wsgicgi
42 REMOTE_PORT="44703"; export REMOTE_PORT
18 > application = hgweb("test", "Empty test repository")
43 REQUEST_METHOD="GET"; export REQUEST_METHOD
19 > wsgicgi.launch(application)
44 REQUEST_URI="/test/"; export REQUEST_URI
20 > HGWEB
45 SCRIPT_FILENAME="/home/hopper/hg_public/test.cgi"; export SCRIPT_FILENAME
21 $ chmod 755 hgweb.cgi
46 SCRIPT_NAME="/test"; export SCRIPT_NAME
22 $ DOCUMENT_ROOT="/var/www/hg"; export DOCUMENT_ROOT
47 SCRIPT_URI="http://hg.omnifarious.org/test/"; export SCRIPT_URI
23 $ GATEWAY_INTERFACE="CGI/1.1"; export GATEWAY_INTERFACE
48 SCRIPT_URL="/test/"; export SCRIPT_URL
24 $ 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
49 SERVER_ADDR="127.0.0.1"; export SERVER_ADDR
25 $ HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"; export HTTP_ACCEPT_CHARSET
50 SERVER_ADMIN="eric@localhost"; export SERVER_ADMIN
26 $ HTTP_ACCEPT_ENCODING="gzip,deflate"; export HTTP_ACCEPT_ENCODING
51 SERVER_NAME="hg.omnifarious.org"; export SERVER_NAME
27 $ HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"; export HTTP_ACCEPT_LANGUAGE
52 SERVER_PORT="80"; export SERVER_PORT
28 $ HTTP_CACHE_CONTROL="max-age=0"; export HTTP_CACHE_CONTROL
53 SERVER_PROTOCOL="HTTP/1.1"; export SERVER_PROTOCOL
29 $ HTTP_CONNECTION="keep-alive"; export HTTP_CONNECTION
54 SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>"; export SERVER_SIGNATURE
30 $ HTTP_HOST="hg.omnifarious.org"; export HTTP_HOST
55 SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE
31 $ HTTP_KEEP_ALIVE="300"; export HTTP_KEEP_ALIVE
32 $ 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
33 $ PATH_INFO="/"; export PATH_INFO
34 $ PATH_TRANSLATED="/var/www/hg/index.html"; export PATH_TRANSLATED
35 $ REMOTE_ADDR="127.0.0.2"; export REMOTE_ADDR
36 $ REMOTE_PORT="44703"; export REMOTE_PORT
37 $ REQUEST_METHOD="GET"; export REQUEST_METHOD
38 $ REQUEST_URI="/test/"; export REQUEST_URI
39 $ SCRIPT_FILENAME="/home/hopper/hg_public/test.cgi"; export SCRIPT_FILENAME
40 $ SCRIPT_NAME="/test"; export SCRIPT_NAME
41 $ SCRIPT_URI="http://hg.omnifarious.org/test/"; export SCRIPT_URI
42 $ SCRIPT_URL="/test/"; export SCRIPT_URL
43 $ SERVER_ADDR="127.0.0.1"; export SERVER_ADDR
44 $ SERVER_ADMIN="eric@localhost"; export SERVER_ADMIN
45 $ SERVER_NAME="hg.omnifarious.org"; export SERVER_NAME
46 $ SERVER_PORT="80"; export SERVER_PORT
47 $ SERVER_PROTOCOL="HTTP/1.1"; export SERVER_PROTOCOL
48 $ SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>"; export SERVER_SIGNATURE
49 $ SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE
56
50
57 echo % try hgweb request
51 try hgweb request
58 QUERY_STRING="cmd=changegroup&roots=0000000000000000000000000000000000000000"; export QUERY_STRING
59 python hgweb.cgi >page1 2>&1 ; echo $?
60 python "$TESTDIR/md5sum.py" page1
61
52
62 exit 0
53 $ QUERY_STRING="cmd=changegroup&roots=0000000000000000000000000000000000000000"; export QUERY_STRING
54 $ python hgweb.cgi >page1 2>&1
55 $ python "$TESTDIR/md5sum.py" page1
56 1f424bb22ec05c3c6bc866b6e67efe43 page1
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