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