author | Matt Harbison <matt_harbison@yahoo.com> |
Fri, 11 Oct 2024 11:03:21 -0400 | |
branch | stable |
changeset 52154 | 6ca0771b32ef |
parent 50734 | d5cd1fd690f3 |
permissions | -rw-r--r-- |
22046
7a9cbb315d84
tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents:
15567
diff
changeset
|
1 |
#require no-msys # MSYS will translate web paths as if they were file paths |
15567
8b84d040d9f9
tests: introduce 'hghave msys' to skip tests that would fail because of msys
Mads Kiilerich <mads@kiilerich.com>
parents:
13269
diff
changeset
|
2 |
|
12471 | 3 |
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
|
4 |
|
12471 | 5 |
$ hg init test |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
6 |
|
12471 | 7 |
$ cat >hgweb.cgi <<HGWEB |
32938
b6776b34e44e
tests: use $PYTHON in #! so we always use the right Python
Augie Fackler <augie@google.com>
parents:
22046
diff
changeset
|
8 |
> #!$PYTHON |
12471 | 9 |
> # |
10 |
> # An example CGI script to use hgweb, edit as necessary |
|
11 |
> |
|
12 |
> from mercurial import demandimport; demandimport.enable() |
|
13 |
> from mercurial.hgweb import hgweb |
|
14 |
> from mercurial.hgweb import wsgicgi |
|
15 |
> |
|
39621
23b749b84b8a
py3: call hgweb.hgweb() with bytes values
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
33262
diff
changeset
|
16 |
> application = hgweb(b"test", b"Empty test repository") |
12471 | 17 |
> wsgicgi.launch(application) |
18 |
> HGWEB |
|
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
19 |
|
12471 | 20 |
$ chmod 755 hgweb.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
21 |
|
12471 | 22 |
$ cat >hgweb.config <<HGWEBDIRCONF |
23 |
> [paths] |
|
24 |
> test = test |
|
25 |
> HGWEBDIRCONF |
|
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
26 |
|
12471 | 27 |
$ cat >hgwebdir.cgi <<HGWEBDIR |
32938
b6776b34e44e
tests: use $PYTHON in #! so we always use the right Python
Augie Fackler <augie@google.com>
parents:
22046
diff
changeset
|
28 |
> #!$PYTHON |
12471 | 29 |
> # |
30 |
> # An example CGI script to export multiple hgweb repos, edit as necessary |
|
31 |
> |
|
32 |
> from mercurial import demandimport; demandimport.enable() |
|
33 |
> from mercurial.hgweb import hgwebdir |
|
34 |
> from mercurial.hgweb import wsgicgi |
|
35 |
> |
|
39727
a2bb0ec3b4d4
py3: add a missing b'' in tests/test-newercgi.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39707
diff
changeset
|
36 |
> application = hgwebdir(b"hgweb.config") |
12471 | 37 |
> wsgicgi.launch(application) |
38 |
> HGWEBDIR |
|
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
39 |
|
12471 | 40 |
$ chmod 755 hgwebdir.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
41 |
|
13269
aa3f726a2bdb
tests: remove duplication of the CGI environment variables
StevenGBrown
parents:
12471
diff
changeset
|
42 |
$ . "$TESTDIR/cgienv" |
39707
5abc47d4ca6b
tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents:
39621
diff
changeset
|
43 |
$ "$PYTHON" hgweb.cgi > page1 |
5abc47d4ca6b
tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents:
39621
diff
changeset
|
44 |
$ "$PYTHON" hgwebdir.cgi > page2 |
12471 | 45 |
|
46 |
$ PATH_INFO="/test/" |
|
47 |
$ PATH_TRANSLATED="/var/something/test.cgi" |
|
48 |
$ REQUEST_URI="/test/test/" |
|
49 |
$ SCRIPT_URI="http://hg.omnifarious.org/test/test/" |
|
50 |
$ SCRIPT_URL="/test/test/" |
|
39707
5abc47d4ca6b
tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents:
39621
diff
changeset
|
51 |
$ "$PYTHON" hgwebdir.cgi > page3 |
12471 | 52 |
|
53 |
$ grep -i error page1 page2 page3 |
|
54 |
[1] |