Mercurial > hg
annotate tests/test-newercgi.t @ 34107:4f60720cf0df
blackbox: fix rotation with chg
The added test will show:
$ $PYTHON showsize.py .hg/blackbox*
.hg/blackbox.log: < 500
.hg/blackbox.log.1: < 500
.hg/blackbox.log.2: < 500
.hg/blackbox.log.3: < 500
.hg/blackbox.log.4: < 500
.hg/blackbox.log.5: >= 500
with previous code.
The issue is caused by blackbox caching file objects *by path*, and the
rotation size check could run on a wrong file object (i.e. it should check
"blackbox.log", but `filehandles["blackbox.log"]` contains a file object
that has been renamed to "blackbox.log.5").
This patch removes the "filehandlers" global cache added by 45313f5a3a8c to
solve the issue.
I think the original patch was trying to make different ui objects use a same
file object if their blackbox.log path is the same. In theory it could also
be problematic in the rotation case. Anyway, that should become unnecessary
after D650.
Differential Revision: https://phab.mercurial-scm.org/D648
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 06 Sep 2017 19:27:30 -0700 |
parents | 8e6f4939a69a |
children | 23b749b84b8a |
rev | line source |
---|---|
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 > 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 > | |
19 > application = hgweb("test", "Empty test repository") | |
20 > wsgicgi.launch(application) | |
21 > HGWEB | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
22 |
12471 | 23 $ chmod 755 hgweb.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
24 |
12471 | 25 $ cat >hgweb.config <<HGWEBDIRCONF |
26 > [paths] | |
27 > test = test | |
28 > HGWEBDIRCONF | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
29 |
12471 | 30 $ 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
|
31 > #!$PYTHON |
12471 | 32 > # |
33 > # An example CGI script to export multiple hgweb repos, edit as necessary | |
34 > | |
35 > import cgitb | |
36 > cgitb.enable() | |
37 > | |
38 > from mercurial import demandimport; demandimport.enable() | |
39 > from mercurial.hgweb import hgwebdir | |
40 > from mercurial.hgweb import wsgicgi | |
41 > | |
42 > application = hgwebdir("hgweb.config") | |
43 > wsgicgi.launch(application) | |
44 > HGWEBDIR | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
45 |
12471 | 46 $ chmod 755 hgwebdir.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
47 |
13269
aa3f726a2bdb
tests: remove duplication of the CGI environment variables
StevenGBrown
parents:
12471
diff
changeset
|
48 $ . "$TESTDIR/cgienv" |
33262
8e6f4939a69a
tests: replace yet more calls to `python` with $PYTHON
Augie Fackler <augie@google.com>
parents:
32938
diff
changeset
|
49 $ $PYTHON hgweb.cgi > page1 |
8e6f4939a69a
tests: replace yet more calls to `python` with $PYTHON
Augie Fackler <augie@google.com>
parents:
32938
diff
changeset
|
50 $ $PYTHON hgwebdir.cgi > page2 |
12471 | 51 |
52 $ PATH_INFO="/test/" | |
53 $ PATH_TRANSLATED="/var/something/test.cgi" | |
54 $ REQUEST_URI="/test/test/" | |
55 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/" | |
56 $ SCRIPT_URL="/test/test/" | |
33262
8e6f4939a69a
tests: replace yet more calls to `python` with $PYTHON
Augie Fackler <augie@google.com>
parents:
32938
diff
changeset
|
57 $ $PYTHON hgwebdir.cgi > page3 |
12471 | 58 |
59 $ grep -i error page1 page2 page3 | |
60 [1] |