##// END OF EJS Templates
tests: add a substitution pattern for HTTP error log dates...
Matt Harbison -
r37495:28e8c594 default
parent child Browse files
Show More
@@ -1,175 +1,179 b''
1 # common patterns in test at can safely be replaced
1 # common patterns in test at can safely be replaced
2 from __future__ import absolute_import
2 from __future__ import absolute_import
3
3
4 import os
4 import os
5
5
6 substitutions = [
6 substitutions = [
7 # list of possible compressions
7 # list of possible compressions
8 (br'(zstd,)?zlib,none,bzip2',
8 (br'(zstd,)?zlib,none,bzip2',
9 br'$USUAL_COMPRESSIONS$'
9 br'$USUAL_COMPRESSIONS$'
10 ),
10 ),
11 (br'=(zstd,)?zlib',
11 (br'=(zstd,)?zlib',
12 br'=$BUNDLE2_COMPRESSIONS$'
12 br'=$BUNDLE2_COMPRESSIONS$'
13 ),
13 ),
14 # capabilities sent through http
14 # capabilities sent through http
15 (br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
15 (br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
16 br'bookmarks%250A'
16 br'bookmarks%250A'
17 br'changegroup%253D01%252C02%250A'
17 br'changegroup%253D01%252C02%250A'
18 br'digests%253Dmd5%252Csha1%252Csha512%250A'
18 br'digests%253Dmd5%252Csha1%252Csha512%250A'
19 br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A'
19 br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A'
20 br'hgtagsfnodes%250A'
20 br'hgtagsfnodes%250A'
21 br'listkeys%250A'
21 br'listkeys%250A'
22 br'phases%253Dheads%250A'
22 br'phases%253Dheads%250A'
23 br'pushkey%250A'
23 br'pushkey%250A'
24 br'remote-changegroup%253Dhttp%252Chttps%250A'
24 br'remote-changegroup%253Dhttp%252Chttps%250A'
25 br'rev-branch-cache%250A'
25 br'rev-branch-cache%250A'
26 br'stream%253Dv2',
26 br'stream%253Dv2',
27 # (the replacement patterns)
27 # (the replacement patterns)
28 br'$USUAL_BUNDLE_CAPS$'
28 br'$USUAL_BUNDLE_CAPS$'
29 ),
29 ),
30 (br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
30 (br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
31 br'bookmarks%250A'
31 br'bookmarks%250A'
32 br'changegroup%253D01%252C02%250A'
32 br'changegroup%253D01%252C02%250A'
33 br'digests%253Dmd5%252Csha1%252Csha512%250A'
33 br'digests%253Dmd5%252Csha1%252Csha512%250A'
34 br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A'
34 br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A'
35 br'hgtagsfnodes%250A'
35 br'hgtagsfnodes%250A'
36 br'listkeys%250A'
36 br'listkeys%250A'
37 br'phases%253Dheads%250A'
37 br'phases%253Dheads%250A'
38 br'pushkey%250A'
38 br'pushkey%250A'
39 br'remote-changegroup%253Dhttp%252Chttps',
39 br'remote-changegroup%253Dhttp%252Chttps',
40 # (the replacement patterns)
40 # (the replacement patterns)
41 br'$USUAL_BUNDLE_CAPS_SERVER$'
41 br'$USUAL_BUNDLE_CAPS_SERVER$'
42 ),
42 ),
43 # bundle2 capabilities sent through ssh
43 # bundle2 capabilities sent through ssh
44 (br'bundle2=HG20%0A'
44 (br'bundle2=HG20%0A'
45 br'bookmarks%0A'
45 br'bookmarks%0A'
46 br'changegroup%3D01%2C02%0A'
46 br'changegroup%3D01%2C02%0A'
47 br'digests%3Dmd5%2Csha1%2Csha512%0A'
47 br'digests%3Dmd5%2Csha1%2Csha512%0A'
48 br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
48 br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
49 br'hgtagsfnodes%0A'
49 br'hgtagsfnodes%0A'
50 br'listkeys%0A'
50 br'listkeys%0A'
51 br'phases%3Dheads%0A'
51 br'phases%3Dheads%0A'
52 br'pushkey%0A'
52 br'pushkey%0A'
53 br'remote-changegroup%3Dhttp%2Chttps%0A'
53 br'remote-changegroup%3Dhttp%2Chttps%0A'
54 br'rev-branch-cache%0A'
54 br'rev-branch-cache%0A'
55 br'stream%3Dv2',
55 br'stream%3Dv2',
56 # (replacement patterns)
56 # (replacement patterns)
57 br'$USUAL_BUNDLE2_CAPS$'
57 br'$USUAL_BUNDLE2_CAPS$'
58 ),
58 ),
59 # bundle2 capabilities advertised by the server
59 # bundle2 capabilities advertised by the server
60 (br'bundle2=HG20%0A'
60 (br'bundle2=HG20%0A'
61 br'bookmarks%0A'
61 br'bookmarks%0A'
62 br'changegroup%3D01%2C02%0A'
62 br'changegroup%3D01%2C02%0A'
63 br'digests%3Dmd5%2Csha1%2Csha512%0A'
63 br'digests%3Dmd5%2Csha1%2Csha512%0A'
64 br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
64 br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
65 br'hgtagsfnodes%0A'
65 br'hgtagsfnodes%0A'
66 br'listkeys%0A'
66 br'listkeys%0A'
67 br'phases%3Dheads%0A'
67 br'phases%3Dheads%0A'
68 br'pushkey%0A'
68 br'pushkey%0A'
69 br'remote-changegroup%3Dhttp%2Chttps%0A'
69 br'remote-changegroup%3Dhttp%2Chttps%0A'
70 br'rev-branch-cache',
70 br'rev-branch-cache',
71 # (replacement patterns)
71 # (replacement patterns)
72 br'$USUAL_BUNDLE2_CAPS_SERVER$'
72 br'$USUAL_BUNDLE2_CAPS_SERVER$'
73 ),
73 ),
74 # HTTP log dates
74 # HTTP access log dates
75 (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "(GET|PUT|POST)',
75 (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "(GET|PUT|POST)',
76 lambda m: br' - - [$LOGDATE$] "' + m.group(1)
76 lambda m: br' - - [$LOGDATE$] "' + m.group(1)
77 ),
77 ),
78 # HTTP error log dates
79 (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] (HG error:|Exception)',
80 lambda m: br' - - [$ERRDATE$] ' + m.group(1)
81 ),
78 # HTTP header dates- RFC 1123
82 # HTTP header dates- RFC 1123
79 (br'([Dd]ate): [A-Za-z]{3}, \d\d [A-Za-z]{3} \d{4} \d\d:\d\d:\d\d GMT',
83 (br'([Dd]ate): [A-Za-z]{3}, \d\d [A-Za-z]{3} \d{4} \d\d:\d\d:\d\d GMT',
80 lambda m: br'%s: $HTTP_DATE$' % m.group(1)
84 lambda m: br'%s: $HTTP_DATE$' % m.group(1)
81 ),
85 ),
82 # LFS expiration value
86 # LFS expiration value
83 (br'"expires_at": "\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ"',
87 (br'"expires_at": "\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ"',
84 br'"expires_at": "$ISO_8601_DATE_TIME$"'
88 br'"expires_at": "$ISO_8601_DATE_TIME$"'
85 ),
89 ),
86 # Windows has an extra '/' in the following lines that get globbed away:
90 # Windows has an extra '/' in the following lines that get globbed away:
87 # pushing to file:/*/$TESTTMP/r2 (glob)
91 # pushing to file:/*/$TESTTMP/r2 (glob)
88 # comparing with file:/*/$TESTTMP/r2 (glob)
92 # comparing with file:/*/$TESTTMP/r2 (glob)
89 # sub/maybelarge.dat: largefile 34..9c not available from
93 # sub/maybelarge.dat: largefile 34..9c not available from
90 # file:/*/$TESTTMP/largefiles-repo (glob)
94 # file:/*/$TESTTMP/largefiles-repo (glob)
91 (br'(.*file:/)/?(/\$TESTTMP.*)',
95 (br'(.*file:/)/?(/\$TESTTMP.*)',
92 lambda m: m.group(1) + b'*' + m.group(2) + b' (glob)'
96 lambda m: m.group(1) + b'*' + m.group(2) + b' (glob)'
93 ),
97 ),
94 ]
98 ]
95
99
96 # Various platform error strings, keyed on a common replacement string
100 # Various platform error strings, keyed on a common replacement string
97 _errors = {
101 _errors = {
98 br'$ENOENT$': (
102 br'$ENOENT$': (
99 # strerror()
103 # strerror()
100 br'No such file or directory',
104 br'No such file or directory',
101
105
102 # FormatMessage(ERROR_FILE_NOT_FOUND)
106 # FormatMessage(ERROR_FILE_NOT_FOUND)
103 br'The system cannot find the file specified',
107 br'The system cannot find the file specified',
104 ),
108 ),
105 br'$ENOTDIR$': (
109 br'$ENOTDIR$': (
106 # strerror()
110 # strerror()
107 br'Not a directory',
111 br'Not a directory',
108
112
109 # FormatMessage(ERROR_PATH_NOT_FOUND)
113 # FormatMessage(ERROR_PATH_NOT_FOUND)
110 br'The system cannot find the path specified',
114 br'The system cannot find the path specified',
111 ),
115 ),
112 br'$ECONNRESET$': (
116 br'$ECONNRESET$': (
113 # strerror()
117 # strerror()
114 br'Connection reset by peer',
118 br'Connection reset by peer',
115
119
116 # FormatMessage(WSAECONNRESET)
120 # FormatMessage(WSAECONNRESET)
117 br'An existing connection was forcibly closed by the remote host',
121 br'An existing connection was forcibly closed by the remote host',
118 ),
122 ),
119 br'$EADDRINUSE$': (
123 br'$EADDRINUSE$': (
120 # strerror()
124 # strerror()
121 br'Address already in use',
125 br'Address already in use',
122
126
123 # FormatMessage(WSAEADDRINUSE)
127 # FormatMessage(WSAEADDRINUSE)
124 br'Only one usage of each socket address'
128 br'Only one usage of each socket address'
125 br' \(protocol/network address/port\) is normally permitted',
129 br' \(protocol/network address/port\) is normally permitted',
126 ),
130 ),
127 }
131 }
128
132
129 for replace, msgs in _errors.items():
133 for replace, msgs in _errors.items():
130 substitutions.extend((m, replace) for m in msgs)
134 substitutions.extend((m, replace) for m in msgs)
131
135
132 # Output lines on Windows that can be autocorrected for '\' vs '/' path
136 # Output lines on Windows that can be autocorrected for '\' vs '/' path
133 # differences.
137 # differences.
134 _winpathfixes = [
138 _winpathfixes = [
135 # cloning subrepo s\ss from $TESTTMP/t/s/ss
139 # cloning subrepo s\ss from $TESTTMP/t/s/ss
136 # cloning subrepo foo\bar from http://localhost:$HGPORT/foo/bar
140 # cloning subrepo foo\bar from http://localhost:$HGPORT/foo/bar
137 br'(?m)^cloning subrepo \S+\\.*',
141 br'(?m)^cloning subrepo \S+\\.*',
138
142
139 # pulling from $TESTTMP\issue1852a
143 # pulling from $TESTTMP\issue1852a
140 br'(?m)^pulling from \$TESTTMP\\.*',
144 br'(?m)^pulling from \$TESTTMP\\.*',
141
145
142 # pushing to $TESTTMP\a
146 # pushing to $TESTTMP\a
143 br'(?m)^pushing to \$TESTTMP\\.*',
147 br'(?m)^pushing to \$TESTTMP\\.*',
144
148
145 # pushing subrepo s\ss to $TESTTMP/t/s/ss
149 # pushing subrepo s\ss to $TESTTMP/t/s/ss
146 br'(?m)^pushing subrepo \S+\\\S+ to.*',
150 br'(?m)^pushing subrepo \S+\\\S+ to.*',
147
151
148 # moving d1\d11\a1 to d3/d11/a1
152 # moving d1\d11\a1 to d3/d11/a1
149 br'(?m)^moving \S+\\.*',
153 br'(?m)^moving \S+\\.*',
150
154
151 # d1\a: not recording move - dummy does not exist
155 # d1\a: not recording move - dummy does not exist
152 br'\S+\\\S+: not recording move .+',
156 br'\S+\\\S+: not recording move .+',
153
157
154 # reverting s\a
158 # reverting s\a
155 br'(?m)^reverting (?!subrepo ).*\\.*',
159 br'(?m)^reverting (?!subrepo ).*\\.*',
156
160
157 # saved backup bundle to
161 # saved backup bundle to
158 # $TESTTMP\test\.hg\strip-backup/443431ffac4f-2fc5398a-backup.hg
162 # $TESTTMP\test\.hg\strip-backup/443431ffac4f-2fc5398a-backup.hg
159 br'(?m)^saved backup bundle to \$TESTTMP.*\.hg',
163 br'(?m)^saved backup bundle to \$TESTTMP.*\.hg',
160
164
161 # no changes made to subrepo s\ss since last push to ../tcc/s/ss
165 # no changes made to subrepo s\ss since last push to ../tcc/s/ss
162 br'(?m)^no changes made to subrepo \S+\\\S+ since.*',
166 br'(?m)^no changes made to subrepo \S+\\\S+ since.*',
163
167
164 # changeset 5:9cc5aa7204f0: stuff/maybelarge.dat references missing
168 # changeset 5:9cc5aa7204f0: stuff/maybelarge.dat references missing
165 # $TESTTMP\largefiles-repo-hg\.hg\largefiles\76..38
169 # $TESTTMP\largefiles-repo-hg\.hg\largefiles\76..38
166 br'(?m)^changeset .* references (corrupted|missing) \$TESTTMP\\.*',
170 br'(?m)^changeset .* references (corrupted|missing) \$TESTTMP\\.*',
167
171
168 # stuff/maybelarge.dat: largefile 76..38 not available from
172 # stuff/maybelarge.dat: largefile 76..38 not available from
169 # file:/*/$TESTTMP\largefiles-repo (glob)
173 # file:/*/$TESTTMP\largefiles-repo (glob)
170 br'.*: largefile \S+ not available from file:/\*/.+',
174 br'.*: largefile \S+ not available from file:/\*/.+',
171 ]
175 ]
172
176
173 if os.name == 'nt':
177 if os.name == 'nt':
174 substitutions.extend([(s, lambda match: match.group().replace(b'\\', b'/'))
178 substitutions.extend([(s, lambda match: match.group().replace(b'\\', b'/'))
175 for s in _winpathfixes])
179 for s in _winpathfixes])
General Comments 0
You need to be logged in to leave comments. Login now