##// END OF EJS Templates
tests: port test-hybridencode.py to unittest...
Augie Fackler -
r37888:6574c81b default
parent child Browse files
Show More
@@ -1,458 +1,459 b''
1 1 test-abort-checkin.t
2 2 test-add.t
3 3 test-addremove-similar.t
4 4 test-addremove.t
5 5 test-amend-subrepo.t
6 6 test-amend.t
7 7 test-ancestor.py
8 8 test-annotate.py
9 9 test-annotate.t
10 10 test-archive-symlinks.t
11 11 test-atomictempfile.py
12 12 test-audit-path.t
13 13 test-audit-subrepo.t
14 14 test-automv.t
15 15 test-backout.t
16 16 test-backwards-remove.t
17 17 test-basic.t
18 18 test-bheads.t
19 19 test-bisect.t
20 20 test-bisect2.t
21 21 test-bisect3.t
22 22 test-blackbox.t
23 23 test-bookmarks-current.t
24 24 test-bookmarks-merge.t
25 25 test-bookmarks-rebase.t
26 26 test-bookmarks-strip.t
27 27 test-bookmarks.t
28 28 test-branch-change.t
29 29 test-branch-option.t
30 30 test-branch-tag-confict.t
31 31 test-branches.t
32 32 test-bundle-phases.t
33 33 test-bundle-type.t
34 34 test-bundle-vs-outgoing.t
35 35 test-bundle2-multiple-changegroups.t
36 36 test-cappedreader.py
37 37 test-casecollision.t
38 38 test-cat.t
39 39 test-censor.t
40 40 test-changelog-exec.t
41 41 test-check-commit.t
42 42 test-check-execute.t
43 43 test-check-interfaces.py
44 44 test-check-module-imports.t
45 45 test-check-pyflakes.t
46 46 test-check-pylint.t
47 47 test-check-shbang.t
48 48 test-children.t
49 49 test-clone-cgi.t
50 50 test-clone-pull-corruption.t
51 51 test-clone-r.t
52 52 test-clone-update-order.t
53 53 test-command-template.t
54 54 test-commit-amend.t
55 55 test-commit-interactive.t
56 56 test-commit-multiple.t
57 57 test-commit-unresolved.t
58 58 test-commit.t
59 59 test-committer.t
60 60 test-completion.t
61 61 test-config-env.py
62 62 test-config.t
63 63 test-conflict.t
64 64 test-confused-revert.t
65 65 test-contrib-check-code.t
66 66 test-contrib-check-commit.t
67 67 test-convert-authormap.t
68 68 test-convert-clonebranches.t
69 69 test-convert-datesort.t
70 70 test-convert-filemap.t
71 71 test-convert-hg-sink.t
72 72 test-convert-hg-source.t
73 73 test-convert-hg-startrev.t
74 74 test-convert-splicemap.t
75 75 test-convert-tagsbranch-topology.t
76 76 test-copy-move-merge.t
77 77 test-copy.t
78 78 test-copytrace-heuristics.t
79 79 test-debugbuilddag.t
80 80 test-debugbundle.t
81 81 test-debugextensions.t
82 82 test-debugindexdot.t
83 83 test-debugrename.t
84 84 test-default-push.t
85 85 test-diff-binary-file.t
86 86 test-diff-change.t
87 87 test-diff-copy-depth.t
88 88 test-diff-hashes.t
89 89 test-diff-ignore-whitespace.t
90 90 test-diff-indent-heuristic.t
91 91 test-diff-issue2761.t
92 92 test-diff-newlines.t
93 93 test-diff-reverse.t
94 94 test-diff-subdir.t
95 95 test-diff-unified.t
96 96 test-diff-upgrade.t
97 97 test-diffdir.t
98 98 test-diffstat.t
99 99 test-directaccess.t
100 100 test-dirstate-backup.t
101 101 test-dirstate-nonnormalset.t
102 102 test-dirstate.t
103 103 test-doctest.py
104 104 test-double-merge.t
105 105 test-drawdag.t
106 106 test-duplicateoptions.py
107 107 test-editor-filename.t
108 108 test-empty-dir.t
109 109 test-empty-file.t
110 110 test-empty-group.t
111 111 test-empty.t
112 112 test-encode.t
113 113 test-encoding-func.py
114 114 test-encoding.t
115 115 test-eol-add.t
116 116 test-eol-clone.t
117 117 test-eol-hook.t
118 118 test-eol-tag.t
119 119 test-eol-update.t
120 120 test-excessive-merge.t
121 121 test-exchange-obsmarkers-case-A1.t
122 122 test-exchange-obsmarkers-case-A2.t
123 123 test-exchange-obsmarkers-case-A3.t
124 124 test-exchange-obsmarkers-case-A4.t
125 125 test-exchange-obsmarkers-case-A5.t
126 126 test-exchange-obsmarkers-case-A6.t
127 127 test-exchange-obsmarkers-case-A7.t
128 128 test-exchange-obsmarkers-case-B1.t
129 129 test-exchange-obsmarkers-case-B2.t
130 130 test-exchange-obsmarkers-case-B3.t
131 131 test-exchange-obsmarkers-case-B4.t
132 132 test-exchange-obsmarkers-case-B5.t
133 133 test-exchange-obsmarkers-case-B6.t
134 134 test-exchange-obsmarkers-case-B7.t
135 135 test-exchange-obsmarkers-case-C1.t
136 136 test-exchange-obsmarkers-case-C2.t
137 137 test-exchange-obsmarkers-case-C3.t
138 138 test-exchange-obsmarkers-case-C4.t
139 139 test-exchange-obsmarkers-case-D1.t
140 140 test-exchange-obsmarkers-case-D2.t
141 141 test-exchange-obsmarkers-case-D3.t
142 142 test-exchange-obsmarkers-case-D4.t
143 143 test-execute-bit.t
144 144 test-export.t
145 145 test-extdata.t
146 146 test-extdiff.t
147 147 test-extra-filelog-entry.t
148 148 test-filebranch.t
149 149 test-fileset-generated.t
150 150 test-fix-topology.t
151 151 test-flags.t
152 152 test-generaldelta.t
153 153 test-getbundle.t
154 154 test-git-export.t
155 155 test-glog-topological.t
156 156 test-gpg.t
157 157 test-graft.t
158 158 test-hg-parseurl.py
159 159 test-hghave.t
160 160 test-hgignore.t
161 161 test-hgk.t
162 162 test-hgweb-bundle.t
163 163 test-hgweb-descend-empties.t
164 164 test-hgweb-empty.t
165 165 test-hgweb-removed.t
166 166 test-hgwebdirsym.t
167 167 test-histedit-arguments.t
168 168 test-histedit-base.t
169 169 test-histedit-bookmark-motion.t
170 170 test-histedit-commute.t
171 171 test-histedit-drop.t
172 172 test-histedit-edit.t
173 173 test-histedit-fold-non-commute.t
174 174 test-histedit-fold.t
175 175 test-histedit-no-change.t
176 176 test-histedit-non-commute-abort.t
177 177 test-histedit-non-commute.t
178 178 test-histedit-obsolete.t
179 179 test-histedit-outgoing.t
180 180 test-histedit-templates.t
181 181 test-http-branchmap.t
182 182 test-http-bundle1.t
183 183 test-http-clone-r.t
184 184 test-http.t
185 test-hybridencode.py
185 186 test-identify.t
186 187 test-import-unknown.t
187 188 test-import.t
188 189 test-imports-checker.t
189 190 test-incoming-outgoing.t
190 191 test-inherit-mode.t
191 192 test-issue1089.t
192 193 test-issue1102.t
193 194 test-issue1175.t
194 195 test-issue1306.t
195 196 test-issue1438.t
196 197 test-issue1502.t
197 198 test-issue1802.t
198 199 test-issue1877.t
199 200 test-issue1993.t
200 201 test-issue2137.t
201 202 test-issue3084.t
202 203 test-issue4074.t
203 204 test-issue522.t
204 205 test-issue586.t
205 206 test-issue612.t
206 207 test-issue619.t
207 208 test-issue660.t
208 209 test-issue672.t
209 210 test-issue842.t
210 211 test-journal-exists.t
211 212 test-journal-share.t
212 213 test-journal.t
213 214 test-largefiles-cache.t
214 215 test-largefiles-misc.t
215 216 test-largefiles-small-disk.t
216 217 test-largefiles-update.t
217 218 test-largefiles.t
218 219 test-lfs-largefiles.t
219 220 test-linerange.py
220 221 test-locate.t
221 222 test-lock-badness.t
222 223 test-log-linerange.t
223 224 test-log.t
224 225 test-logexchange.t
225 226 test-lrucachedict.py
226 227 test-mactext.t
227 228 test-mailmap.t
228 229 test-manifest-merging.t
229 230 test-manifest.py
230 231 test-manifest.t
231 232 test-match.py
232 233 test-mdiff.py
233 234 test-merge-changedelete.t
234 235 test-merge-closedheads.t
235 236 test-merge-commit.t
236 237 test-merge-criss-cross.t
237 238 test-merge-default.t
238 239 test-merge-force.t
239 240 test-merge-halt.t
240 241 test-merge-internal-tools-pattern.t
241 242 test-merge-local.t
242 243 test-merge-remove.t
243 244 test-merge-revert.t
244 245 test-merge-revert2.t
245 246 test-merge-subrepos.t
246 247 test-merge-symlinks.t
247 248 test-merge-tools.t
248 249 test-merge-types.t
249 250 test-merge1.t
250 251 test-merge10.t
251 252 test-merge2.t
252 253 test-merge4.t
253 254 test-merge5.t
254 255 test-merge6.t
255 256 test-merge7.t
256 257 test-merge8.t
257 258 test-merge9.t
258 259 test-mq-git.t
259 260 test-mq-header-date.t
260 261 test-mq-header-from.t
261 262 test-mq-merge.t
262 263 test-mq-pull-from-bundle.t
263 264 test-mq-qclone-http.t
264 265 test-mq-qdelete.t
265 266 test-mq-qdiff.t
266 267 test-mq-qfold.t
267 268 test-mq-qgoto.t
268 269 test-mq-qimport-fail-cleanup.t
269 270 test-mq-qnew.t
270 271 test-mq-qpush-exact.t
271 272 test-mq-qqueue.t
272 273 test-mq-qrefresh-interactive.t
273 274 test-mq-qrefresh-replace-log-message.t
274 275 test-mq-qrefresh.t
275 276 test-mq-qrename.t
276 277 test-mq-qsave.t
277 278 test-mq-safety.t
278 279 test-mq-subrepo.t
279 280 test-mq-symlinks.t
280 281 test-mv-cp-st-diff.t
281 282 test-narrow-archive.t
282 283 test-narrow-clone-no-ellipsis.t
283 284 test-narrow-clone-non-narrow-server.t
284 285 test-narrow-clone-nonlinear.t
285 286 test-narrow-clone.t
286 287 test-narrow-commit.t
287 288 test-narrow-copies.t
288 289 test-narrow-debugcommands.t
289 290 test-narrow-debugrebuilddirstate.t
290 291 test-narrow-exchange-merges.t
291 292 test-narrow-exchange.t
292 293 test-narrow-expanddirstate.t
293 294 test-narrow-merge.t
294 295 test-narrow-patch.t
295 296 test-narrow-patterns.t
296 297 test-narrow-pull.t
297 298 test-narrow-rebase.t
298 299 test-narrow-shallow-merges.t
299 300 test-narrow-shallow.t
300 301 test-narrow-strip.t
301 302 test-narrow-update.t
302 303 test-nested-repo.t
303 304 test-newbranch.t
304 305 test-obshistory.t
305 306 test-obsmarker-template.t
306 307 test-obsmarkers-effectflag.t
307 308 test-obsolete-bundle-strip.t
308 309 test-obsolete-changeset-exchange.t
309 310 test-obsolete-checkheads.t
310 311 test-obsolete-distributed.t
311 312 test-obsolete-tag-cache.t
312 313 test-parents.t
313 314 test-pathconflicts-merge.t
314 315 test-pathconflicts-update.t
315 316 test-pending.t
316 317 test-permissions.t
317 318 test-phases.t
318 319 test-pull-branch.t
319 320 test-pull-http.t
320 321 test-pull-permission.t
321 322 test-pull-pull-corruption.t
322 323 test-pull-r.t
323 324 test-pull-update.t
324 325 test-purge.t
325 326 test-push-checkheads-partial-C1.t
326 327 test-push-checkheads-partial-C2.t
327 328 test-push-checkheads-partial-C3.t
328 329 test-push-checkheads-partial-C4.t
329 330 test-push-checkheads-pruned-B1.t
330 331 test-push-checkheads-pruned-B2.t
331 332 test-push-checkheads-pruned-B3.t
332 333 test-push-checkheads-pruned-B4.t
333 334 test-push-checkheads-pruned-B5.t
334 335 test-push-checkheads-pruned-B6.t
335 336 test-push-checkheads-pruned-B7.t
336 337 test-push-checkheads-pruned-B8.t
337 338 test-push-checkheads-superceed-A1.t
338 339 test-push-checkheads-superceed-A2.t
339 340 test-push-checkheads-superceed-A3.t
340 341 test-push-checkheads-superceed-A4.t
341 342 test-push-checkheads-superceed-A5.t
342 343 test-push-checkheads-superceed-A6.t
343 344 test-push-checkheads-superceed-A7.t
344 345 test-push-checkheads-superceed-A8.t
345 346 test-push-checkheads-unpushed-D1.t
346 347 test-push-checkheads-unpushed-D2.t
347 348 test-push-checkheads-unpushed-D3.t
348 349 test-push-checkheads-unpushed-D4.t
349 350 test-push-checkheads-unpushed-D5.t
350 351 test-push-checkheads-unpushed-D6.t
351 352 test-push-checkheads-unpushed-D7.t
352 353 test-push-http.t
353 354 test-push-warn.t
354 355 test-pushvars.t
355 356 test-rebase-abort.t
356 357 test-rebase-base-flag.t
357 358 test-rebase-bookmarks.t
358 359 test-rebase-brute-force.t
359 360 test-rebase-cache.t
360 361 test-rebase-check-restore.t
361 362 test-rebase-collapse.t
362 363 test-rebase-conflicts.t
363 364 test-rebase-dest.t
364 365 test-rebase-detach.t
365 366 test-rebase-emptycommit.t
366 367 test-rebase-inmemory.t
367 368 test-rebase-interruptions.t
368 369 test-rebase-issue-noparam-single-rev.t
369 370 test-rebase-legacy.t
370 371 test-rebase-mq-skip.t
371 372 test-rebase-mq.t
372 373 test-rebase-named-branches.t
373 374 test-rebase-newancestor.t
374 375 test-rebase-obsolete.t
375 376 test-rebase-parameters.t
376 377 test-rebase-partial.t
377 378 test-rebase-pull.t
378 379 test-rebase-rename.t
379 380 test-rebase-scenario-global.t
380 381 test-rebase-templates.t
381 382 test-rebase-transaction.t
382 383 test-record.t
383 384 test-relink.t
384 385 test-remove.t
385 386 test-rename-after-merge.t
386 387 test-rename-dir-merge.t
387 388 test-rename-merge1.t
388 389 test-rename.t
389 390 test-repair-strip.t
390 391 test-repo-compengines.t
391 392 test-resolve.t
392 393 test-revert-flags.t
393 394 test-revert-unknown.t
394 395 test-revlog-ancestry.py
395 396 test-revlog-group-emptyiter.t
396 397 test-revlog-mmapindex.t
397 398 test-revlog-packentry.t
398 399 test-revset-dirstate-parents.t
399 400 test-revset-legacy-lookup.t
400 401 test-revset-outgoing.t
401 402 test-rollback.t
402 403 test-run-tests.py
403 404 test-run-tests.t
404 405 test-schemes.t
405 406 test-serve.t
406 407 test-setdiscovery.t
407 408 test-share.t
408 409 test-shelve.t
409 410 test-show-stack.t
410 411 test-show-work.t
411 412 test-show.t
412 413 test-simple-update.t
413 414 test-single-head.t
414 415 test-sparse-clear.t
415 416 test-sparse-import.t
416 417 test-sparse-merges.t
417 418 test-sparse-profiles.t
418 419 test-sparse-requirement.t
419 420 test-sparse-verbose-json.t
420 421 test-ssh-clone-r.t
421 422 test-ssh-proto.t
422 423 test-sshserver.py
423 424 test-stack.t
424 425 test-status-rev.t
425 426 test-status-terse.t
426 427 test-strip-cross.t
427 428 test-strip.t
428 429 test-subrepo-deep-nested-change.t
429 430 test-subrepo-missing.t
430 431 test-subrepo-recursion.t
431 432 test-subrepo-relative-path.t
432 433 test-subrepo.t
433 434 test-symlinks.t
434 435 test-tag.t
435 436 test-tags.t
436 437 test-template-engine.t
437 438 test-treemanifest.t
438 439 test-unamend.t
439 440 test-uncommit.t
440 441 test-unified-test.t
441 442 test-unrelated-pull.t
442 443 test-up-local-change.t
443 444 test-update-branches.t
444 445 test-update-dest.t
445 446 test-update-issue1456.t
446 447 test-update-names.t
447 448 test-update-reverse.t
448 449 test-upgrade-repo.t
449 450 test-url-download.t
450 451 test-url-rev.t
451 452 test-username-newline.t
452 453 test-verify.t
453 454 test-websub.t
454 455 test-win32text.t
455 456 test-wireproto-clientreactor.py
456 457 test-wireproto-framing.py
457 458 test-wireproto-serverreactor.py
458 459 test-xdg.t
This diff has been collapsed as it changes many lines, (1256 lines changed) Show them Hide them
@@ -1,471 +1,877 b''
1 1 from __future__ import absolute_import, print_function
2
3 import unittest
4
2 5 from mercurial import (
3 6 store,
4 7 )
5 8
6 def show(s):
7 # show test input
8 print("A = '%s'" % s.encode("string_escape"))
9
10 # show the result of the C implementation, if available
11 h = store._pathencode(s)
12 print("B = '%s'" % h.encode("string_escape"))
9 class hybridencodetests(unittest.TestCase):
10 def hybridencode(self, input, want):
13 11
14 # compare it with reference implementation in Python
15 r = store._hybridencode(s, True)
16 if h != r:
17 print("R = '%s'" % r.encode("string_escape"))
18 print()
19
20 show("data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&'()+,-.;=[]^`{}")
12 # Check the C implementation if it's in use
13 got = store._pathencode(input)
14 self.assertEqual(want, got)
15 # Check the reference implementation in Python
16 refgot = store._hybridencode(input, True)
17 self.assertEqual(want, refgot)
21 18
22 print("uppercase char X is encoded as _x")
23 show("data/ABCDEFGHIJKLMNOPQRSTUVWXYZ")
24
25 print("underbar is doubled")
26 show("data/_")
27
28 print("tilde is character-encoded")
29 show("data/~")
19 def testnoencodingrequired(self):
20 self.hybridencode(
21 b'data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&\'()+,-.;=[]^`{}',
22 b'data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&\'()+,-.;=[]^`{}')
30 23
31 print("characters in ASCII code range 1..31")
32 show('data/\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f'
33 '\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f')
24 def testuppercasechars(self): # uppercase char X is encoded as _x
25 self.hybridencode(
26 b'data/ABCDEFGHIJKLMNOPQRSTUVWXYZ',
27 b'data/_a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_z')
28
29 def testunderbar(self): # underbar is doubled
30 self.hybridencode(b'data/_', b'data/__')
34 31
35 print("characters in ASCII code range 126..255")
36 show('data/\x7e\x7f'
37 '\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f'
38 '\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f')
39 show('data/\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf'
40 '\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf')
41 show('data/\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf'
42 '\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf')
43 show('data/\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef'
44 '\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff')
32 def testtilde(self): # tilde is character-encoded
33 self.hybridencode(b'data/~', b'data/~7e')
45 34
46 print("Windows reserved characters")
47 show('data/less <, greater >, colon :, double-quote ", backslash \\'
48 ', pipe |, question-mark ?, asterisk *')
49
50 print("encoding directories ending in .hg, .i or .d with '.hg' suffix")
51 show('data/x.h.i/x.hg/x.i/x.d/foo')
52 show('data/a.hg/a.i/a.d/foo')
53 show('data/au.hg/au.i/au.d/foo')
54 show('data/aux.hg/aux.i/aux.d/foo')
55 show('data/auxy.hg/auxy.i/auxy.d/foo')
35 def testcontrolchars(self): # characters in ASCII code range 1..31
36 self.hybridencode(
37 (b'data/\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'
38 b'\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e'
39 b'\x1f'),
40 (b'data/~01~02~03~04~05~06~07~08~09~0a~0b~0c~0d~0e~0f~10~11~12~13'
41 b'~14~15~16~17~18~19~1a~1b~1c~1d~1e~1f'))
56 42
57 print("but these are not encoded on *filenames*")
58 show('data/foo/x.hg')
59 show('data/foo/x.i')
60 show('data/foo/x.d')
61 show('data/foo/a.hg')
62 show('data/foo/a.i')
63 show('data/foo/a.d')
64 show('data/foo/au.hg')
65 show('data/foo/au.i')
66 show('data/foo/au.d')
67 show('data/foo/aux.hg')
68 show('data/foo/aux.i')
69 show('data/foo/aux.d')
70 show('data/foo/auxy.hg')
71 show('data/foo/auxy.i')
72 show('data/foo/auxy.d')
43 def testhighascii(self):# characters in ASCII code range 126..255
44 self.hybridencode(
45 (b'data/~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c'
46 b'\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b'
47 b'\x9c\x9d\x9e\x9f'),
48 (b'data/~7e~7f~80~81~82~83~84~85~86~87~88~89~8a~8b~8c~8d~8e~8f~90'
49 b'~91~92~93~94~95~96~97~98~99~9a~9b~9c~9d~9e~9f'))
50 self.hybridencode(
51 (b'data/\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad'
52 b'\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc'
53 b'\xbd\xbe\xbf'),
54 (b'data/~a0~a1~a2~a3~a4~a5~a6~a7~a8~a9~aa~ab~ac~ad~ae~af~b0~b1~b2'
55 b'~b3~b4~b5~b6~b7~b8~b9~ba~bb~bc~bd~be~bf'))
56 self.hybridencode(
57 (b'data/\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca'
58 b'\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6'
59 b'\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf'),
60 (b'data/~c0~c1~c2~c3~c4~c5~c6~c7~c8~c9~ca~cb~cc~cd~ce~cf~d0~d1~d2'
61 b'~d3~d4~d5~d6~d7~d8~d9~da~db~dc~dd~de~df'))
62 self.hybridencode(
63 (b'data/\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed'
64 b'\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd'
65 b'\xfe\xff'),
66 (b'data/~e0~e1~e2~e3~e4~e5~e6~e7~e8~e9~ea~eb~ec~ed~ee~ef~f0~f1~f2'
67 b'~f3~f4~f5~f6~f7~f8~f9~fa~fb~fc~fd~fe~ff'))
73 68
74 print("plain .hg, .i and .d directories have the leading dot encoded")
75 show('data/.hg/.i/.d/foo')
76
77 show('data/aux.bla/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c.i')
69 def testwinreserved(self): # Windows reserved characters
70 self.hybridencode(
71 (b'data/less <, greater >, colon :, double-quote ", backslash \\, '
72 b'pipe |, question-mark ?, asterisk *'),
73 (b'data/less ~3c, greater ~3e, colon ~3a, double-quote ~22, '
74 b'backslash ~5c, pipe ~7c, question-mark ~3f, asterisk ~2a'))
78 75
79 show('data/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/'
80 'TENTH/ELEVENTH/LOREMIPSUM.TXT.i')
81 show('data/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/'
82 'wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules'
83 '.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider.i')
84 show('data/AUX.THE-QUICK-BROWN-FOX-JU:MPS-OVER-THE-LAZY-DOG-THE-QUICK-'
85 'BROWN-FOX-JUMPS-OVER-THE-LAZY-DOG.TXT.i')
86 show('data/Project Planning/Resources/AnotherLongDirectoryName/'
87 'Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt')
88 show('data/Project.Planning/Resources/AnotherLongDirectoryName/'
89 'Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt')
90 show('data/foo.../foo / /a./_. /__/.x../ bla/.FOO/something.i')
76 def testhgreserved(self):
77 # encoding directories ending in .hg, .i or .d with '.hg' suffix
78 self.hybridencode(b'data/x.h.i/x.hg/x.i/x.d/foo',
79 b'data/x.h.i.hg/x.hg.hg/x.i.hg/x.d.hg/foo')
80 self.hybridencode(b'data/a.hg/a.i/a.d/foo',
81 b'data/a.hg.hg/a.i.hg/a.d.hg/foo')
82 self.hybridencode(b'data/au.hg/au.i/au.d/foo',
83 b'data/au.hg.hg/au.i.hg/au.d.hg/foo')
84 self.hybridencode(b'data/aux.hg/aux.i/aux.d/foo',
85 b'data/au~78.hg.hg/au~78.i.hg/au~78.d.hg/foo')
86 self.hybridencode(b'data/auxy.hg/auxy.i/auxy.d/foo',
87 b'data/auxy.hg.hg/auxy.i.hg/auxy.d.hg/foo')
88 # but these are not encoded on *filenames*
89 self.hybridencode(b'data/foo/x.hg', b'data/foo/x.hg')
90 self.hybridencode(b'data/foo/x.i', b'data/foo/x.i')
91 self.hybridencode(b'data/foo/x.d', b'data/foo/x.d')
92 self.hybridencode(b'data/foo/a.hg', b'data/foo/a.hg')
93 self.hybridencode(b'data/foo/a.i', b'data/foo/a.i')
94 self.hybridencode(b'data/foo/a.d', b'data/foo/a.d')
95 self.hybridencode(b'data/foo/au.hg', b'data/foo/au.hg')
96 self.hybridencode(b'data/foo/au.i', b'data/foo/au.i')
97 self.hybridencode(b'data/foo/au.d', b'data/foo/au.d')
98 self.hybridencode(b'data/foo/aux.hg', b'data/foo/au~78.hg')
99 self.hybridencode(b'data/foo/aux.i', b'data/foo/au~78.i')
100 self.hybridencode(b'data/foo/aux.d', b'data/foo/au~78.d')
101 self.hybridencode(b'data/foo/auxy.hg', b'data/foo/auxy.hg')
102 self.hybridencode(b'data/foo/auxy.i', b'data/foo/auxy.i')
103 self.hybridencode(b'data/foo/auxy.d', b'data/foo/auxy.d')
91 104
92 show('data/c/co/com/com0/com1/com2/com3/com4/com5/com6/com7/com8/com9')
93 show('data/C/CO/COM/COM0/COM1/COM2/COM3/COM4/COM5/COM6/COM7/COM8/COM9')
94 show('data/c.x/co.x/com.x/com0.x/com1.x/com2.x/com3.x/com4.x/com5.x'
95 '/com6.x/com7.x/com8.x/com9.x')
96 show('data/x.c/x.co/x.com0/x.com1/x.com2/x.com3/x.com4/x.com5'
97 '/x.com6/x.com7/x.com8/x.com9')
98 show('data/cx/cox/comx/com0x/com1x/com2x/com3x/com4x/com5x'
99 '/com6x/com7x/com8x/com9x')
100 show('data/xc/xco/xcom0/xcom1/xcom2/xcom3/xcom4/xcom5'
101 '/xcom6/xcom7/xcom8/xcom9')
102
103 show('data/l/lp/lpt/lpt0/lpt1/lpt2/lpt3/lpt4/lpt5/lpt6/lpt7/lpt8/lpt9')
104 show('data/L/LP/LPT/LPT0/LPT1/LPT2/LPT3/LPT4/LPT5/LPT6/LPT7/LPT8/LPT9')
105 show('data/l.x/lp.x/lpt.x/lpt0.x/lpt1.x/lpt2.x/lpt3.x/lpt4.x/lpt5.x'
106 '/lpt6.x/lpt7.x/lpt8.x/lpt9.x')
107 show('data/x.l/x.lp/x.lpt/x.lpt0/x.lpt1/x.lpt2/x.lpt3/x.lpt4/x.lpt5'
108 '/x.lpt6/x.lpt7/x.lpt8/x.lpt9')
109 show('data/lx/lpx/lptx/lpt0x/lpt1x/lpt2x/lpt3x/lpt4x/lpt5x'
110 '/lpt6x/lpt7x/lpt8x/lpt9x')
111 show('data/xl/xlp/xlpt/xlpt0/xlpt1/xlpt2/xlpt3/xlpt4/xlpt5'
112 '/xlpt6/xlpt7/xlpt8/xlpt9')
113
114 show('data/con/p/pr/prn/a/au/aux/n/nu/nul')
115 show('data/CON/P/PR/PRN/A/AU/AUX/N/NU/NUL')
116 show('data/con.x/p.x/pr.x/prn.x/a.x/au.x/aux.x/n.x/nu.x/nul.x')
117 show('data/x.con/x.p/x.pr/x.prn/x.a/x.au/x.aux/x.n/x.nu/x.nul')
118 show('data/conx/px/prx/prnx/ax/aux/auxx/nx/nux/nulx')
119 show('data/xcon/xp/xpr/xprn/xa/xau/xaux/xn/xnu/xnul')
105 # plain .hg, .i and .d directories have the leading dot encoded
106 self.hybridencode(b'data/.hg/.i/.d/foo',
107 b'data/~2ehg.hg/~2ei.hg/~2ed.hg/foo')
120 108
121 show('data/a./au./aux./auxy./aux.')
122 show('data/c./co./con./cony./con.')
123 show('data/p./pr./prn./prny./prn.')
124 show('data/n./nu./nul./nuly./nul.')
125 show('data/l./lp./lpt./lpt1./lpt1y./lpt1.')
126 show('data/lpt9./lpt9y./lpt9.')
127 show('data/com./com1./com1y./com1.')
128 show('data/com9./com9y./com9.')
129
130 show('data/a /au /aux /auxy /aux ')
131
132 print("largest unhashed path")
133 show('data/123456789-123456789-123456789-123456789-123456789-'
134 'unhashed--xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
135 '123456789-12345')
136
137 print("shortest hashed path")
138 show('data/123456789-123456789-123456789-123456789-123456789-'
139 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
140 '123456789-123456')
141
142 print("changing one char in part that's hashed away produces a different hash")
143 show('data/123456789-123456789-123456789-123456789-123456789-'
144 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxy-'
145 '123456789-123456')
109 def testmisclongcases(self):
110 self.hybridencode(
111 (b'data/aux.bla/bla.aux/prn/PRN/lpt/com3/nul/'
112 b'coma/foo.NUL/normal.c.i'),
113 (b'data/au~78.bla/bla.aux/pr~6e/_p_r_n/lpt/co~6d3'
114 b'/nu~6c/coma/foo._n_u_l/normal.c.i'))
115 self.hybridencode(
116 (b'data/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH'
117 b'/TENTH/ELEVENTH/LOREMIPSUM.TXT.i'),
118 (b'dh/au~78/second/x.prn/fourth/fi~3afth/sixth/seventh/eighth/'
119 b'nineth/tenth/loremia20419e358ddff1bf8751e38288aff1d7c32ec05.i'))
120 self.hybridencode(
121 (b'data/enterprise/openesbaddons/contrib-imola/corba-bc/'
122 b'netbeansplugin/wsdlExtension/src/main/java/META-INF/services'
123 b'/org.netbeans.modules.xml.wsdl.bindingsupport.spi.'
124 b'ExtensibilityElementTemplateProvider.i'),
125 (b'dh/enterpri/openesba/contrib-/corba-bc/netbeans/wsdlexte/src/'
126 b'main/java/org.net7018f27961fdf338a598a40c4683429e7ffb9743.i'))
127 self.hybridencode(
128 (b'data/AUX.THE-QUICK-BROWN-FOX-JU:MPS-OVER-THE-LAZY-DOG-THE-'
129 b'QUICK-BROWN-FOX-JUMPS-OVER-THE-LAZY-DOG.TXT.i'),
130 (b'dh/au~78.the-quick-brown-fox-ju~3amps-over-the-lazy-dog-the-'
131 b'quick-brown-fox-jud4dcadd033000ab2b26eb66bae1906bcb15d4a70.i'))
132 self.hybridencode(
133 (b'data/Project Planning/Resources/AnotherLongDirectoryName/Follow'
134 b'edbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt'),
135 (b'dh/project_/resource/anotherl/followed/andanoth/andthenanextrem'
136 b'elylongfilenaf93030515d9849cfdca52937c2204d19f83913e5.txt'))
137 self.hybridencode(
138 (b'data/Project.Planning/Resources/AnotherLongDirectoryName/Follo'
139 b'wedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt'),
140 (b'dh/project_/resource/anotherl/followed/andanoth/andthenanextre'
141 b'melylongfilena0fd7c506f5c9d58204444fc67e9499006bd2d445.txt'))
142 self.hybridencode(
143 b'data/foo.../foo / /a./_. /__/.x../ bla/.FOO/something.i',
144 (b'data/foo..~2e/foo ~20/~20/a~2e/__.~20/____/~2ex.~2e/~20 bla/'
145 b'~2e_f_o_o/something.i'))
146 self.hybridencode(
147 b'data/c/co/com/com0/com1/com2/com3/com4/com5/com6/com7/com8/com9',
148 (b'data/c/co/com/com0/co~6d1/co~6d2/co~6d3/co~6d4/co~6d5/co~6d6/'
149 b'co~6d7/co~6d8/co~6d9'))
150 self.hybridencode(
151 b'data/C/CO/COM/COM0/COM1/COM2/COM3/COM4/COM5/COM6/COM7/COM8/COM9',
152 (b'data/_c/_c_o/_c_o_m/_c_o_m0/_c_o_m1/_c_o_m2/_c_o_m3/_c_o_m4/'
153 b'_c_o_m5/_c_o_m6/_c_o_m7/_c_o_m8/_c_o_m9'))
154 self.hybridencode(
155 (b'data/c.x/co.x/com.x/com0.x/com1.x/com2.x/com3.x/com4.x/com5.x/'
156 b'com6.x/com7.x/com8.x/com9.x'),
157 (b'data/c.x/co.x/com.x/com0.x/co~6d1.x/co~6d2.x/co~6d3.x/co~6d4.x'
158 b'/co~6d5.x/co~6d6.x/co~6d7.x/co~6d8.x/co~6d9.x'))
159 self.hybridencode(
160 (b'data/x.c/x.co/x.com0/x.com1/x.com2/x.com3/x.com4/x.com5/x.com6'
161 b'/x.com7/x.com8/x.com9'),
162 (b'data/x.c/x.co/x.com0/x.com1/x.com2/x.com3/x.com4/x.com5/x.com6'
163 b'/x.com7/x.com8/x.com9'))
164 self.hybridencode(
165 (b'data/cx/cox/comx/com0x/com1x/com2x/com3x/com4x/com5x/com6x/'
166 b'com7x/com8x/com9x'),
167 (b'data/cx/cox/comx/com0x/com1x/com2x/com3x/com4x/com5x/com6x/'
168 b'com7x/com8x/com9x'))
169 self.hybridencode(
170 (b'data/xc/xco/xcom0/xcom1/xcom2/xcom3/xcom4/xcom5/xcom6/xcom7/'
171 b'xcom8/xcom9'),
172 (b'data/xc/xco/xcom0/xcom1/xcom2/xcom3/xcom4/xcom5/xcom6/xcom7/'
173 b'xcom8/xcom9'))
174 self.hybridencode(
175 b'data/l/lp/lpt/lpt0/lpt1/lpt2/lpt3/lpt4/lpt5/lpt6/lpt7/lpt8/lpt9',
176 (b'data/l/lp/lpt/lpt0/lp~741/lp~742/lp~743/lp~744/lp~745/lp~746/'
177 b'lp~747/lp~748/lp~749'))
178 self.hybridencode(
179 b'data/L/LP/LPT/LPT0/LPT1/LPT2/LPT3/LPT4/LPT5/LPT6/LPT7/LPT8/LPT9',
180 (b'data/_l/_l_p/_l_p_t/_l_p_t0/_l_p_t1/_l_p_t2/_l_p_t3/_l_p_t4/'
181 b'_l_p_t5/_l_p_t6/_l_p_t7/_l_p_t8/_l_p_t9'))
182 self.hybridencode(
183 (b'data/l.x/lp.x/lpt.x/lpt0.x/lpt1.x/lpt2.x/lpt3.x/lpt4.x/lpt5.x/'
184 b'lpt6.x/lpt7.x/lpt8.x/lpt9.x'),
185 (b'data/l.x/lp.x/lpt.x/lpt0.x/lp~741.x/lp~742.x/lp~743.x/lp~744.x/'
186 b'lp~745.x/lp~746.x/lp~747.x/lp~748.x/lp~749.x'))
187 self.hybridencode(
188 (b'data/x.l/x.lp/x.lpt/x.lpt0/x.lpt1/x.lpt2/x.lpt3/x.lpt4/x.lpt5/'
189 b'x.lpt6/x.lpt7/x.lpt8/x.lpt9'),
190 (b'data/x.l/x.lp/x.lpt/x.lpt0/x.lpt1/x.lpt2/x.lpt3/x.lpt4/x.lpt5'
191 b'/x.lpt6/x.lpt7/x.lpt8/x.lpt9'))
192 self.hybridencode(
193 (b'data/lx/lpx/lptx/lpt0x/lpt1x/lpt2x/lpt3x/lpt4x/lpt5x/lpt6x/'
194 b'lpt7x/lpt8x/lpt9x'),
195 (b'data/lx/lpx/lptx/lpt0x/lpt1x/lpt2x/lpt3x/lpt4x/lpt5x/lpt6x/'
196 b'lpt7x/lpt8x/lpt9x'))
197 self.hybridencode(
198 (b'data/xl/xlp/xlpt/xlpt0/xlpt1/xlpt2/xlpt3/xlpt4/xlpt5/xlpt6/'
199 b'xlpt7/xlpt8/xlpt9'),
200 (b'data/xl/xlp/xlpt/xlpt0/xlpt1/xlpt2/xlpt3/xlpt4/xlpt5/xlpt6/'
201 b'xlpt7/xlpt8/xlpt9'))
202 self.hybridencode(b'data/con/p/pr/prn/a/au/aux/n/nu/nul',
203 b'data/co~6e/p/pr/pr~6e/a/au/au~78/n/nu/nu~6c')
204 self.hybridencode(
205 b'data/CON/P/PR/PRN/A/AU/AUX/N/NU/NUL',
206 b'data/_c_o_n/_p/_p_r/_p_r_n/_a/_a_u/_a_u_x/_n/_n_u/_n_u_l')
207 self.hybridencode(
208 b'data/con.x/p.x/pr.x/prn.x/a.x/au.x/aux.x/n.x/nu.x/nul.x',
209 b'data/co~6e.x/p.x/pr.x/pr~6e.x/a.x/au.x/au~78.x/n.x/nu.x/nu~6c.x')
210 self.hybridencode(
211 b'data/x.con/x.p/x.pr/x.prn/x.a/x.au/x.aux/x.n/x.nu/x.nul',
212 b'data/x.con/x.p/x.pr/x.prn/x.a/x.au/x.aux/x.n/x.nu/x.nul')
213 self.hybridencode(b'data/conx/px/prx/prnx/ax/aux/auxx/nx/nux/nulx',
214 b'data/conx/px/prx/prnx/ax/au~78/auxx/nx/nux/nulx')
215 self.hybridencode(b'data/xcon/xp/xpr/xprn/xa/xau/xaux/xn/xnu/xnul',
216 b'data/xcon/xp/xpr/xprn/xa/xau/xaux/xn/xnu/xnul')
217 self.hybridencode(b'data/a./au./aux./auxy./aux.',
218 b'data/a~2e/au~2e/au~78~2e/auxy~2e/au~78~2e')
219 self.hybridencode(b'data/c./co./con./cony./con.',
220 b'data/c~2e/co~2e/co~6e~2e/cony~2e/co~6e~2e')
221 self.hybridencode(b'data/p./pr./prn./prny./prn.',
222 b'data/p~2e/pr~2e/pr~6e~2e/prny~2e/pr~6e~2e')
223 self.hybridencode(b'data/n./nu./nul./nuly./nul.',
224 b'data/n~2e/nu~2e/nu~6c~2e/nuly~2e/nu~6c~2e')
225 self.hybridencode(
226 b'data/l./lp./lpt./lpt1./lpt1y./lpt1.',
227 b'data/l~2e/lp~2e/lpt~2e/lp~741~2e/lpt1y~2e/lp~741~2e')
228 self.hybridencode(b'data/lpt9./lpt9y./lpt9.',
229 b'data/lp~749~2e/lpt9y~2e/lp~749~2e')
230 self.hybridencode(b'data/com./com1./com1y./com1.',
231 b'data/com~2e/co~6d1~2e/com1y~2e/co~6d1~2e')
232 self.hybridencode(b'data/com9./com9y./com9.',
233 b'data/co~6d9~2e/com9y~2e/co~6d9~2e')
234 self.hybridencode(b'data/a /au /aux /auxy /aux ',
235 b'data/a~20/au~20/aux~20/auxy~20/aux~20')
146 236
147 print("uppercase hitting length limit due to encoding")
148 show('data/A23456789-123456789-123456789-123456789-123456789-'
149 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
150 '123456789-12345')
151 show('data/Z23456789-123456789-123456789-123456789-123456789-'
152 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
153 '123456789-12345')
154
155 print("compare with lowercase not hitting limit")
156 show('data/a23456789-123456789-123456789-123456789-123456789-'
157 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
158 '123456789-12345')
159 show('data/z23456789-123456789-123456789-123456789-123456789-'
160 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
161 '123456789-12345')
162
163 print("not hitting limit with any of these")
164 show("data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&'()+,-.;="
165 "[]^`{}xxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-"
166 "123456789-12345")
167
168 print("underbar hitting length limit due to encoding")
169 show('data/_23456789-123456789-123456789-123456789-123456789-'
170 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
171 '123456789-12345')
172
173 print("tilde hitting length limit due to encoding")
174 show('data/~23456789-123456789-123456789-123456789-123456789-'
175 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
176 '123456789-12345')
237 def testhashingboundarycases(self):
238 # largest unhashed path
239 self.hybridencode(
240 (b'data/123456789-123456789-123456789-123456789-123456789-unhashed'
241 b'--xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12345'),
242 (b'data/123456789-123456789-123456789-123456789-123456789-unhashed'
243 b'--xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12345'))
244 # shortest hashed path
245 self.hybridencode(
246 (b'data/123456789-123456789-123456789-123456789-123456789-hashed'
247 b'----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
248 (b'dh/123456789-123456789-123456789-123456789-123456789-hashed---'
249 b'-xxxxxxxxx-xxxxxxxe9c55002b50bf5181e7a6fc1f60b126e2a6fcf71'))
177 250
178 print("Windows reserved characters hitting length limit")
179 show('data/<23456789-123456789-123456789-123456789-123456789-'
180 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
181 '123456789-12345')
182 show('data/>23456789-123456789-123456789-123456789-123456789-'
183 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
184 '123456789-12345')
185 show('data/:23456789-123456789-123456789-123456789-123456789-'
186 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
187 '123456789-12345')
188 show('data/"23456789-123456789-123456789-123456789-123456789-'
189 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
190 '123456789-12345')
191 show('data/\\23456789-123456789-123456789-123456789-123456789-'
192 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
193 '123456789-12345')
194 show('data/|23456789-123456789-123456789-123456789-123456789-'
195 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
196 '123456789-12345')
197 show('data/?23456789-123456789-123456789-123456789-123456789-'
198 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
199 '123456789-12345')
200 show('data/*23456789-123456789-123456789-123456789-123456789-'
201 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
202 '123456789-12345')
251 def testhashing(self):
252 # changing one char in part that's hashed away produces a different hash
253 self.hybridencode(
254 (b'data/123456789-123456789-123456789-123456789-123456789-hashed'
255 b'----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxy-123456789-123456'),
256 (b'dh/123456789-123456789-123456789-123456789-123456789-hashed---'
257 b'-xxxxxxxxx-xxxxxxxd24fa4455faf8a94350c18e5eace7c2bb17af706'))
258 # uppercase hitting length limit due to encoding
259 self.hybridencode(
260 (b'data/A23456789-123456789-123456789-123456789-123456789-'
261 b'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
262 b'123456789-12345'),
263 (b'dh/a23456789-123456789-123456789-123456789-123456789-'
264 b'xxxxxxxxx-xxxxxxxxx-xxxxxxx'
265 b'cbbc657029b41b94ed510d05feb6716a5c03bc6b'))
266 self.hybridencode(
267 (b'data/Z23456789-123456789-123456789-123456789-123456789-'
268 b'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
269 b'123456789-12345'),
270 (b'dh/z23456789-123456789-123456789-123456789-123456789-xxxxxxxxx'
271 b'-xxxxxxxxx-xxxxxxx938f32a725c89512833fb96b6602dd9ebff51ddd'))
272 # compare with lowercase not hitting limit
273 self.hybridencode(
274 (b'data/a23456789-123456789-123456789-123456789-123456789-'
275 b'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-'
276 b'12345'),
277 (b'data/a23456789-123456789-123456789-123456789-123456789-'
278 b'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-'
279 b'12345'))
280 self.hybridencode(
281 (b'data/z23456789-123456789-123456789-123456789-123456789'
282 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789'
283 b'-12345'),
284 (b'data/z23456789-123456789-123456789-123456789-123456789'
285 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-'
286 b'12345'))
287 # not hitting limit with any of these
288 self.hybridencode(
289 (b'data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&\'()+,-.;=[]^`{}'
290 b'xxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12345'),
291 (b'data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&\'()+,-.;=[]^`{}'
292 b'xxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12345'))
293 # underbar hitting length limit due to encoding
294 self.hybridencode(
295 (b'data/_23456789-123456789-123456789-123456789-123456789-'
296 b'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-'
297 b'12345'),
298 (b'dh/_23456789-123456789-123456789-123456789-123456789-xxxxxxxxx-'
299 b'xxxxxxxxx-xxxxxxx9921a01af50feeabc060ce00eee4cba6efc31d2b'))
300
301 # tilde hitting length limit due to encoding
302 self.hybridencode(
303 (b'data/~23456789-123456789-123456789-123456789-123456789-'
304 b'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-'
305 b'12345'),
306 (b'dh/~7e23456789-123456789-123456789-123456789-123456789'
307 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
308 b'9cec6f97d569c10995f785720044ea2e4227481b'))
203 309
204 print("initial space hitting length limit")
205 show('data/ 23456789-123456789-123456789-123456789-123456789-'
206 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
207 '123456789-12345')
208
209 print("initial dot hitting length limit")
210 show('data/.23456789-123456789-123456789-123456789-123456789-'
211 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
212 '123456789-12345')
213
214 print("trailing space in filename hitting length limit")
215 show('data/123456789-123456789-123456789-123456789-123456789-'
216 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
217 '123456789-1234 ')
310 def testwinreservedoverlimit(self):
311 # Windows reserved characters hitting length limit
312 self.hybridencode(
313 (b'data/<23456789-123456789-123456789-123456789-123456789'
314 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
315 b'-123456789-12345'),
316 (b'dh/~3c23456789-123456789-123456789-123456789-123456789'
317 b'-xxxxxxxxx-xxxxxxxxx-xxxxxee'
318 b'67d8f275876ca1ef2500fc542e63c885c4e62d'))
319 self.hybridencode(
320 (b'data/>23456789-123456789-123456789-123456789-123456789-'
321 b'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
322 b'123456789-12345'),
323 (b'dh/~3e23456789-123456789-123456789-123456789-123456789'
324 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
325 b'387a85a5b1547cc9136310c974df716818458ddb'))
326 self.hybridencode(
327 (b'data/:23456789-123456789-123456789-123456789-123456789'
328 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
329 b'123456789-12345'),
330 (b'dh/~3a23456789-123456789-123456789-123456789-123456789'
331 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
332 b'2e4154fb571d13d22399c58cc4ef4858e4b75999'))
333 self.hybridencode(
334 (b'data/"23456789-123456789-123456789-123456789-123456789'
335 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
336 b'-123456789-12345'),
337 (b'dh/~2223456789-123456789-123456789-123456789-123456789'
338 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
339 b'fc7e3ec7b0687ee06ed8c32fef0eb0c1980259f5'))
340 self.hybridencode(
341 (b'data/\\23456789-123456789-123456789-123456789-123456789'
342 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
343 b'123456789-12345'),
344 (b'dh/~5c23456789-123456789-123456789-123456789-123456789'
345 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
346 b'944e1f2b7110687e116e0d151328ac648b06ab4a'))
347 self.hybridencode(
348 (b'data/|23456789-123456789-123456789-123456789-123456789'
349 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
350 b'-123456789-12345'),
351 (b'dh/~7c23456789-123456789-123456789-123456789-123456789'
352 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
353 b'28b23dd3fd0242946334126ab62bcd772aac32f4'))
354 self.hybridencode(
355 (b'data/?23456789-123456789-123456789-123456789-123456789'
356 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
357 b'-123456789-12345'),
358 (b'dh/~3f23456789-123456789-123456789-123456789-123456789'
359 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
360 b'a263022d3994d2143d98f94f431eef8b5e7e0f8a'))
361 self.hybridencode(
362 (b'data/*23456789-123456789-123456789-123456789-123456789'
363 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
364 b'123456789-12345'),
365 (b'dh/~2a23456789-123456789-123456789-123456789-123456789'
366 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
367 b'0e7e6020e3c00ba7bb7893d84ca2966fbf53e140'))
218 368
219 print("trailing dot in filename hitting length limit")
220 show('data/123456789-123456789-123456789-123456789-123456789-'
221 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
222 '123456789-1234.')
369 def testinitialspacelenlimit(self):
370 # initial space hitting length limit
371 self.hybridencode(
372 (b'data/ 23456789-123456789-123456789-123456789-123456789'
373 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
374 b'123456789-12345'),
375 (b'dh/~2023456789-123456789-123456789-123456789-123456789'
376 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
377 b'92acbc78ef8c0b796111629a02601f07d8aec4ea'))
223 378
224 print("initial space in directory hitting length limit")
225 show('data/ x/456789-123456789-123456789-123456789-123456789-'
226 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
227 '123456789-12345')
379 def testinitialdotlenlimit(self):
380 # initial dot hitting length limit
381 self.hybridencode(
382 (b'data/.23456789-123456789-123456789-123456789-123456789'
383 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
384 b'-123456789-12345'),
385 (b'dh/~2e23456789-123456789-123456789-123456789-123456789'
386 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
387 b'dbe19cc6505b3515ab9228cebf877ad07075168f'))
388
389 def testtrailingspacelenlimit(self):
390 # trailing space in filename hitting length limit
391 self.hybridencode(
392 (b'data/123456789-123456789-123456789-123456789-123456789'
393 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
394 b'123456789-1234 '),
395 (b'dh/123456789-123456789-123456789-123456789-123456789'
396 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxx'
397 b'0025dc73e04f97426db4893e3bf67d581dc6d066'))
228 398
229 print("initial dot in directory hitting length limit")
230 show('data/.x/456789-123456789-123456789-123456789-123456789-'
231 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
232 '123456789-12345')
399 def testtrailingdotlenlimit(self):
400 # trailing dot in filename hitting length limit
401 self.hybridencode(
402 (b'data/123456789-123456789-123456789-123456789-123456789'
403 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-'
404 b'1234.'),
405 (b'dh/123456789-123456789-123456789-123456789-123456789'
406 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxx'
407 b'85a16cf03ee7feba8a5abc626f1ba9886d01e89d'))
408
409 def testinitialspacedirlenlimit(self):
410 # initial space in directory hitting length limit
411 self.hybridencode(
412 (b'data/ x/456789-123456789-123456789-123456789-123456789'
413 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
414 b'-123456789-12345'),
415 (b'dh/~20x/456789-123456789-123456789-123456789-123456789'
416 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
417 b'1b3a3b712b2ac00d6af14ae8b4c14fdbf904f516'))
233 418
234 print("trailing space in directory hitting length limit")
235 show('data/x /456789-123456789-123456789-123456789-123456789-'
236 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
237 '123456789-12345')
419 def testinitialdotdirlenlimit(self):
420 # initial dot in directory hitting length limit
421 self.hybridencode(
422 (b'data/.x/456789-123456789-123456789-123456789-123456789'
423 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
424 b'-123456789-12345'),
425 (b'dh/~2ex/456789-123456789-123456789-123456789-123456789'
426 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
427 b'39dbc4c193a5643a8936fc69c3363cd7ac91ab14'))
428
429 def testtrailspacedirlenlimit(self):
430 # trailing space in directory hitting length limit
431 self.hybridencode(
432 (b'data/x /456789-123456789-123456789-123456789-123456789'
433 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
434 b'-123456789-12345'),
435 (b'dh/x~20/456789-123456789-123456789-123456789-123456789'
436 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
437 b'2253c341df0b5290790ad312cd8499850f2273e5'))
238 438
239 print("trailing dot in directory hitting length limit")
240 show('data/x./456789-123456789-123456789-123456789-123456789-'
241 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
242 '123456789-12345')
439 def testtrailingdotdirlenlimit(self):
440 # trailing dot in directory hitting length limit
441 self.hybridencode(
442 (b'data/x./456789-123456789-123456789-123456789-123456789'
443 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
444 b'123456789-12345'),
445 (b'dh/x~2e/456789-123456789-123456789-123456789-123456789'
446 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
447 b'cc0324d696d34562b44b5138db08ee1594ccc583'))
243 448
244 print("with directories that need direncoding, hitting length limit")
245 show('data/x.i/56789-123456789-123456789-123456789-123456789-'
246 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
247 '123456789-12345')
248 show('data/x.d/56789-123456789-123456789-123456789-123456789-'
249 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
250 '123456789-12345')
251 show('data/x.hg/5789-123456789-123456789-123456789-123456789-'
252 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
253 '123456789-12345')
449 def testdirencodinglenlimit(self):
450 # with directories that need direncoding, hitting length limit
451 self.hybridencode(
452 (b'data/x.i/56789-123456789-123456789-123456789-123456789'
453 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-'
454 b'12345'),
455 (b'dh/x.i.hg/56789-123456789-123456789-123456789-123456789'
456 b'-xxxxxxxxx-xxxxxxxxx-xxxx'
457 b'a4c4399bdf81c67dbbbb7060aa0124d8dea94f74'))
458 self.hybridencode(
459 (b'data/x.d/56789-123456789-123456789-123456789-123456789'
460 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
461 b'-123456789-12345'),
462 (b'dh/x.d.hg/56789-123456789-123456789-123456789-123456789'
463 b'-xxxxxxxxx-xxxxxxxxx-xxxx'
464 b'1303fa90473b230615f5b3ea7b660e881ae5270a'))
465 self.hybridencode(
466 (b'data/x.hg/5789-123456789-123456789-123456789-123456789'
467 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
468 b'-123456789-12345'),
469 (b'dh/x.hg.hg/5789-123456789-123456789-123456789-123456789'
470 b'-xxxxxxxxx-xxxxxxxxx-xxxx'
471 b'26d724a8af68e7a4e4455e6602ea9adbd0eb801f'))
254 472
255 print("Windows reserved filenames, hitting length limit")
256 show('data/con/56789-123456789-123456789-123456789-123456789-'
257 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
258 '123456789-12345')
259 show('data/prn/56789-123456789-123456789-123456789-123456789-'
260 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
261 '123456789-12345')
262 show('data/aux/56789-123456789-123456789-123456789-123456789-'
263 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
264 '123456789-12345')
265 show('data/nul/56789-123456789-123456789-123456789-123456789-'
266 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
267 '123456789-12345')
268 show('data/com1/6789-123456789-123456789-123456789-123456789-'
269 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
270 '123456789-12345')
271 show('data/com9/6789-123456789-123456789-123456789-123456789-'
272 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
273 '123456789-12345')
274 show('data/lpt1/6789-123456789-123456789-123456789-123456789-'
275 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
276 '123456789-12345')
277 show('data/lpt9/6789-123456789-123456789-123456789-123456789-'
278 'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
279 '123456789-12345')
473 def testwinreservedfilenameslimit(self):
474 # Windows reserved filenames, hitting length limit
475 self.hybridencode(
476 (b'data/con/56789-123456789-123456789-123456789-123456789'
477 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
478 b'123456789-12345'),
479 (b'dh/co~6e/56789-123456789-123456789-123456789-123456789'
480 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
481 b'c0794d4f4c605a2617900eb2563d7113cf6ea7d3'))
482 self.hybridencode(
483 (b'data/prn/56789-123456789-123456789-123456789-123456789'
484 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
485 b'-123456789-12345'),
486 (b'dh/pr~6e/56789-123456789-123456789-123456789-123456789'
487 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
488 b'64db876e1a9730e27236cb9b167aff942240e932'))
489 self.hybridencode(
490 (b'data/aux/56789-123456789-123456789-123456789-123456789'
491 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
492 b'-123456789-12345'),
493 (b'dh/au~78/56789-123456789-123456789-123456789-123456789'
494 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
495 b'8a178558405ca6fb4bbd75446dfa186f06751a0d'))
496 self.hybridencode(
497 (b'data/nul/56789-123456789-123456789-123456789-123456789'
498 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
499 b'-123456789-12345'),
500 (b'dh/nu~6c/56789-123456789-123456789-123456789-123456789'
501 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
502 b'c5e51b6fec1bd07bd243b053a0c3f7209855b886'))
503 self.hybridencode(
504 (b'data/com1/6789-123456789-123456789-123456789-123456789'
505 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
506 b'-123456789-12345'),
507 (b'dh/co~6d1/6789-123456789-123456789-123456789-123456789'
508 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
509 b'32f5f44ece3bb62b9327369ca84cc19c86259fcd'))
510 self.hybridencode(
511 (b'data/com9/6789-123456789-123456789-123456789-123456789'
512 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
513 b'-123456789-12345'),
514 (b'dh/co~6d9/6789-123456789-123456789-123456789-123456789'
515 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
516 b'734360b28c66a3230f55849fe8926206d229f990'))
517 self.hybridencode(
518 (b'data/lpt1/6789-123456789-123456789-123456789-123456789'
519 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
520 b'-123456789-12345'),
521 (b'dh/lp~741/6789-123456789-123456789-123456789-123456789'
522 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
523 b'e6f16ab4b6b0637676b2842b3345c9836df46ef7'))
524 self.hybridencode(
525 (b'data/lpt9/6789-123456789-123456789-123456789-123456789'
526 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
527 b'-123456789-12345'),
528 (b'dh/lp~749/6789-123456789-123456789-123456789-123456789'
529 b'-xxxxxxxxx-xxxxxxxxx-xxxxx'
530 b'a475814c51acead3e44f2ff801f0c4903f986157'))
280 531
281 print("non-reserved names, just not hitting limit")
282 show('data/123456789-123456789-123456789-123456789-123456789-'
283 '/com/com0/lpt/lpt0/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
284 '123456789-12345')
285
286 print("hashed path with largest untruncated 1st dir")
287 show('data/12345678/-123456789-123456789-123456789-123456789-'
288 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
289 '123456789-123456')
290
291 print("hashed path with smallest truncated 1st dir")
292 show('data/123456789/123456789-123456789-123456789-123456789-'
293 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
294 '123456789-123456')
532 def testnonreservednolimit(self):
533 # non-reserved names, just not hitting limit
534 self.hybridencode(
535 (b'data/123456789-123456789-123456789-123456789-123456789-'
536 b'/com/com0/lpt/lpt0/'
537 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12345'),
538 (b'data/123456789-123456789-123456789-123456789-123456789-'
539 b'/com/com0/lpt/lpt0/'
540 b'-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12345'))
295 541
296 print("hashed path with largest untruncated two dirs")
297 show('data/12345678/12345678/9-123456789-123456789-123456789-'
298 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
299 '123456789-123456')
542 def testhashedpathuntrucfirst(self):
543 # hashed path with largest untruncated 1st dir
544 self.hybridencode(
545 (b'data/12345678/-123456789-123456789-123456789-123456789-hashed'
546 b'----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
547 (b'dh/12345678/-123456789-123456789-123456789-123456789-hashed'
548 b'----xxxxxxxxx-xxxxxxx4e9e9e384d00929a93b6835fbf976eb32321ff3c'))
300 549
301 print("hashed path with smallest truncated two dirs")
302 show('data/123456789/123456789/123456789-123456789-123456789-'
303 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
304 '123456789-123456')
550 def testhashedpathsmallesttrucdir(self):
551 # hashed path with smallest truncated 1st dir
552 self.hybridencode(
553 (b'data/123456789/123456789-123456789-123456789-123456789-hashed'
554 b'----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
555 (b'dh/12345678/123456789-123456789-123456789-123456789-hashed'
556 b'----xxxxxxxxx-xxxxxxxx1f4e4ec5f2be76e109bfaa8e31c062fe426d5490'))
305 557
306 print("hashed path with largest untruncated three dirs")
307 show('data/12345678/12345678/12345678/89-123456789-123456789-'
308 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
309 '123456789-123456')
558 def testhashedlargesttwountruc(self):
559 # hashed path with largest untruncated two dirs
560 self.hybridencode(
561 (b'data/12345678/12345678/9-123456789-123456789-123456789-hashed'
562 b'----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
563 (b'dh/12345678/12345678/9-123456789-123456789-123456789-hashed'
564 b'----xxxxxxxxx-xxxxxxx3332d8329d969cf835542a9f2cbcfb385b6cf39d'))
310 565
311 print("hashed path with smallest truncated three dirs")
312 show('data/123456789/123456789/123456789/123456789-123456789-'
313 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
314 '123456789-123456')
566 def testhashedpathsmallesttrunctwodirs(self):
567 # hashed path with smallest truncated two dirs
568 self.hybridencode(
569 (b'data/123456789/123456789/123456789-123456789-123456789-hashed'
570 b'----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
571 (b'dh/12345678/12345678/123456789-123456789-123456789-hashed'
572 b'----xxxxxxxxx-xxxxxxxxx'
573 b'9699559798247dffa18717138859be5f8874840e'))
315 574
316 print("hashed path with largest untruncated four dirs")
317 show('data/12345678/12345678/12345678/12345678/789-123456789-'
318 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
319 '123456789-123456')
575 def testhashuntruncthree(self):
576 # hashed path with largest untruncated three dirs
577 self.hybridencode(
578 (b'data/12345678/12345678/12345678/89-123456789-123456789-'
579 b'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
580 b'123456789-123456'),
581 (b'dh/12345678/12345678/12345678/89-123456789-123456789-hashed'
582 b'----xxxxxxxxx-xxxxxxxf0a2b053bb1369cce02f78c217d6a7aaea18c439'))
320 583
321 print("hashed path with smallest truncated four dirs")
322 show('data/123456789/123456789/123456789/123456789/123456789-'
323 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
324 '123456789-123456')
584 def testhashtruncthree(self):
585 # hashed path with smallest truncated three dirs
586 self.hybridencode(
587 (b'data/123456789/123456789/123456789/123456789-123456789-hashed'
588 b'----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
589 (b'dh/12345678/12345678/12345678/123456789-123456789-hashed'
590 b'----xxxxxxxxx-xxxxxxxxx-'
591 b'1c6f8284967384ec13985a046d3553179d9d03cd'))
325 592
326 print("hashed path with largest untruncated five dirs")
327 show('data/12345678/12345678/12345678/12345678/12345678/6789-'
328 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
329 '123456789-123456')
593 def testhashuntrucfour(self):
594 # hashed path with largest untruncated four dirs
595 self.hybridencode(
596 (b'data/12345678/12345678/12345678/12345678/789-123456789-hashed'
597 b'----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
598 (b'dh/12345678/12345678/12345678/12345678/789-123456789-hashed'
599 b'----xxxxxxxxx-xxxxxxx0d30c99049d8f0ff97b94d4ef302027e8d54c6fd'))
330 600
331 print("hashed path with smallest truncated five dirs")
332 show('data/123456789/123456789/123456789/123456789/123456789/'
333 'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
334 '123456789-123456')
601 def testhashtruncfour(self):
602 # hashed path with smallest truncated four dirs
603 self.hybridencode(
604 (b'data/123456789/123456789/123456789/123456789/123456789-hashed'
605 b'----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
606 (b'dh/12345678/12345678/12345678/12345678/123456789-hashed'
607 b'----xxxxxxxxx-xxxxxxxxx-x'
608 b'46162779e1a771810b37a737f82ae7ed33771402'))
335 609
336 print("hashed path with largest untruncated six dirs")
337 show('data/12345678/12345678/12345678/12345678/12345678/12345'
338 '678/ed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
339 '123456789-123456')
610 def testhashuntruncfive(self):
611 # hashed path with largest untruncated five dirs
612 self.hybridencode(
613 (b'data/12345678/12345678/12345678/12345678/12345678/6789-hashed'
614 b'----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
615 (b'dh/12345678/12345678/12345678/12345678/12345678/6789-hashed'
616 b'----xxxxxxxxx-xxxxxxxbfe752ddc8b003c2790c66a9f2eb1ea75c114390'))
340 617
341 print("hashed path with smallest truncated six dirs")
342 show('data/123456789/123456789/123456789/123456789/123456789/'
343 '123456789/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
344 '123456789-123456')
618 def testhashtruncfive(self):
619 # hashed path with smallest truncated five dirs
620 self.hybridencode(
621 (b'data/123456789/123456789/123456789/123456789/123456789/hashed'
622 b'----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
623 (b'dh/12345678/12345678/12345678/12345678/12345678/hashed'
624 b'----xxxxxxxxx-xxxxxxxxx-xx'
625 b'b94c27b3532fa880cdd572b1c514785cab7b6ff2'))
626
627 def testhashuntruncsix(self):
628 # hashed path with largest untruncated six dirs
629 self.hybridencode(
630 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
631 b'ed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
632 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/'
633 b'ed----xxxxxxxxx-xxxxxxx'
634 b'cd8cc5483a0f3be409e0e5d4bf9e36e113c59235'))
345 635
346 print("hashed path with largest untruncated seven dirs")
347 show('data/12345678/12345678/12345678/12345678/12345678/12345'
348 '678/12345678/xxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
349 '123456789-123456')
636 def testhashtruncsix(self):
637 # hashed path with smallest truncated six dirs
638 self.hybridencode(
639 (b'data/123456789/123456789/123456789/123456789/123456789/'
640 b'123456789/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
641 b'123456789-123456'),
642 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/'
643 b'xxxxxxxxx-xxxxxxxxx-xxx'
644 b'47dd6f616f833a142da00701b334cebbf640da06'))
350 645
351 print("hashed path with smallest truncated seven dirs")
352 show('data/123456789/123456789/123456789/123456789/123456789/'
353 '123456789/123456789/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
354 '123456789-123456')
646 def testhashuntrunc7(self):
647 # hashed path with largest untruncated seven dirs
648 self.hybridencode(
649 (b'data/12345678/12345678/12345678/12345678/12345678/12345678'
650 b'/12345678/xxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
651 b'123456789-123456'),
652 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678'
653 b'/12345678/xxxxxx-xxxxxxx'
654 b'1c8ed635229fc22efe51035feeadeb4c8a0ecb82'))
355 655
356 print("hashed path with largest untruncated eight dirs")
357 print("(directory 8 is dropped because it hits _maxshortdirslen)")
358 show('data/12345678/12345678/12345678/12345678/12345678/12345'
359 '678/12345678/12345678/xxxxxxx-xxxxxxxxx-xxxxxxxxx-'
360 '123456789-123456')
656 def testhashtrunc7(self):
657 # hashed path with smallest truncated seven dirs
658 self.hybridencode(
659 (b'data/123456789/123456789/123456789/123456789/123456789/'
660 b'123456789/123456789/'
661 b'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
662 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/123'
663 b'45678/xxxxxxxxx-xxxx298ff7d33f8ce6db57930837ffea2fb2f48bb926'))
361 664
362 print("hashed path with smallest truncated eight dirs")
363 print("(directory 8 is dropped because it hits _maxshortdirslen)")
364 show('data/123456789/123456789/123456789/123456789/123456789/'
365 '123456789/123456789/123456789/xxxxxxxxx-xxxxxxxxx-'
366 '123456789-123456')
665 def testhashuntrunc8(self):
666 # hashed path with largest untruncated eight dirs
667 # (directory 8 is dropped because it hits _maxshortdirslen)
668 self.hybridencode(
669 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
670 b'12345678/12345678/xxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
671 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/1'
672 b'2345678/xxxxxxx-xxxxxxc8996ccd41b471f768057181a4d59d2febe7277d'))
367 673
368 print("hashed path with largest non-dropped directory 8")
369 print("(just not hitting the _maxshortdirslen boundary)")
370 show('data/12345678/12345678/12345678/12345678/12345678/12345'
371 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
372 '123456789-123456')
674 def testhashtrunc8(self):
675 # hashed path with smallest truncated eight dirs
676 # (directory 8 is dropped because it hits _maxshortdirslen)
677 self.hybridencode(
678 (b'data/123456789/123456789/123456789/123456789/123456789/'
679 b'123456789/123456789/123456789/xxxxxxxxx-xxxxxxxxx-'
680 b'123456789-123456'),
681 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678'
682 b'/12345678/xxxxxxxxx-xxxx'
683 b'4fa04a839a6bda93e1c21c713f2edcbd16e8890d'))
373 684
374 print("...adding one truncated char to dir 1..7 won't drop dir 8")
375 show('data/12345678x/12345678/12345678/12345678/12345678/12345'
376 '678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
377 '123456789-123456')
378 show('data/12345678/12345678x/12345678/12345678/12345678/12345'
379 '678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
380 '123456789-123456')
381 show('data/12345678/12345678/12345678x/12345678/12345678/12345'
382 '678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
383 '123456789-123456')
384 show('data/12345678/12345678/12345678/12345678x/12345678/12345'
385 '678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
386 '123456789-123456')
387 show('data/12345678/12345678/12345678/12345678/12345678x/12345'
388 '678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
389 '123456789-123456')
390 show('data/12345678/12345678/12345678/12345678/12345678/12345'
391 '678x/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
392 '123456789-123456')
393 show('data/12345678/12345678/12345678/12345678/12345678/12345'
394 '678/12345678x/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
395 '123456789-123456')
685 def testhashnondropped8(self):
686 # hashed path with largest non-dropped directory 8
687 # (just not hitting the _maxshortdirslen boundary)
688 self.hybridencode(
689 (b'data/12345678/12345678/12345678/12345678/12345678/12345678'
690 b'/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789'
691 b'-123456'),
692 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678'
693 b'/12345678/12345/-xxxxxxx'
694 b'4d43d1ccaa20efbfe99ec779dc063611536ff2c5'))
695 # ...adding one truncated char to dir 1..7 won't drop dir 8
696 self.hybridencode(
697 (b'data/12345678x/12345678/12345678/12345678/12345678/12345678'
698 b'/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
699 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/1234'
700 b'5678/12345/xxxxxxxx0f9efce65189cc60fd90fe4ffd49d7b58bbe0f2e'))
701 self.hybridencode(
702 (b'data/12345678/12345678x/12345678/12345678/12345678/12345678'
703 b'/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
704 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/1234'
705 b'5678/12345/xxxxxxxx945ca395708cafdd54a94501859beabd3e243921'))
706 self.hybridencode(
707 (b'data/12345678/12345678/12345678x/12345678/12345678/12345678/12'
708 b'345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
709 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/1234'
710 b'5678/12345/xxxxxxxxac62bf6898c4fd0502146074547c11caa751a327'))
711 self.hybridencode(
712 (b'data/12345678/12345678/12345678/12345678x/12345678/12345678/12'
713 b'345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
714 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/1234'
715 b'5678/12345/xxxxxxxx2ae5a2baed7983fae8974d0ca06c6bf08b9aee92'))
716 self.hybridencode(
717 (b'data/12345678/12345678/12345678/12345678/12345678x/12345678/'
718 b'12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
719 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/1234'
720 b'5678/12345/xxxxxxxx214aba07b6687532a43d1e9eaf6e88cfca96b68c'))
721 self.hybridencode(
722 (b'data/12345678/12345678/12345678/12345678/12345678/12345678x'
723 b'/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
724 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/1234'
725 b'5678/12345/xxxxxxxxe7a022ae82f0f55cf4e0498e55ba59ea4ebb55bf'))
726 self.hybridencode(
727 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
728 b'12345678x/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
729 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12345'
730 b'678/12345/xxxxxxxxb51ce61164996a80f36ce3cfe64b62d519aedae3'))
396 731
397 print("hashed path with shortest dropped directory 8")
398 print("(just hitting the _maxshortdirslen boundary)")
399 show('data/12345678/12345678/12345678/12345678/12345678/12345'
400 '678/12345678/123456/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
401 '123456789-123456')
402
403 print("hashed path that drops dir 8 due to dot or space at end is")
404 print("encoded, and thus causing to hit _maxshortdirslen")
405 show('data/12345678/12345678/12345678/12345678/12345678/12345'
406 '678/12345678/1234./-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
407 '123456789-123456')
408 show('data/12345678/12345678/12345678/12345678/12345678/12345'
409 '678/12345678/1234 /-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
410 '123456789-123456')
732 def testhashedpathshortestdropped8(self):
733 # hashed path with shortest dropped directory 8
734 # (just hitting the _maxshortdirslen boundary)
735 self.hybridencode(
736 (b'data/12345678/12345678/12345678/12345678/12345678/12345678'
737 b'/12345678/123456/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
738 b'123456789-123456'),
739 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678'
740 b'/12345678/xxxxxxxxx-xxxx'
741 b'11fa9873cc6c3215eae864528b5530a04efc6cfe'))
411 742
412 print("... with dir 8 short enough for encoding")
413 show('data/12345678/12345678/12345678/12345678/12345678/12345'
414 '678/12345678/12./xx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
415 '123456789-123456')
416 show('data/12345678/12345678/12345678/12345678/12345678/12345'
417 '678/12345678/12 /xx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
418 '123456789-123456')
743 def testhashedpathdropsdir8fortrailingdotspace(self):
744 # hashed path that drops dir 8 due to dot or space at end is
745 # encoded, and thus causing to hit _maxshortdirslen
746 self.hybridencode(
747 (b'data/12345678/12345678/12345678/12345678/12345678/12345678'
748 b'/12345678/1234./-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
749 b'123456789-123456'),
750 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678'
751 b'/12345678/-xxxxxxxxx-xxx'
752 b'602df9b45bec564e2e1f0645d5140dddcc76ed58'))
753 self.hybridencode(
754 (b'data/12345678/12345678/12345678/12345678/12345678/12345678'
755 b'/12345678/1234 /-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
756 b'123456789-123456'),
757 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678'
758 b'/12345678/-xxxxxxxxx-xxx'
759 b'd99ff212bc84b4d1f70cd6b0071e3ef69d4e12ce'))
760 # ... with dir 8 short enough for encoding
761 self.hybridencode(
762 (b'data/12345678/12345678/12345678/12345678/12345678/12345678'
763 b'/12345678/12./xx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx'
764 b'-123456789-123456'),
765 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678'
766 b'/12345678/12~2e/'
767 b'xx-xxxxx7baeb5ed7f14a586ee1cacecdbcbff70032d1b3c'))
768 self.hybridencode(
769 (b'data/12345678/12345678/12345678/12345678/12345678/12345678'
770 b'/12345678/12 '
771 b'/xx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-123456'),
772 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678'
773 b'/12345678/12~20/'
774 b'xx-xxxxxcf79ca9795f77d7f75745da36807e5d772bd5182'))
419 775
420 print('''Extensions are replicated on hashed paths. Note that
421 we only get to encode files that end in .i or .d inside the
422 store. Encoded filenames are thus bound in length.''')
423 show('data/12345678/12345678/12345678/12345678/12345678/12345'
424 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
425 '123456789-12.345.i')
426 show('data/12345678/12345678/12345678/12345678/12345678/12345'
427 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
428 '123456789-12.345.d')
429 show('data/12345678/12345678/12345678/12345678/12345678/12345'
430 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
431 '123456789-12.3456.i')
432 show('data/12345678/12345678/12345678/12345678/12345678/12345'
433 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
434 '123456789-12.34567.i')
435 show('data/12345678/12345678/12345678/12345678/12345678/12345'
436 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
437 '123456789-12.345678.i')
438 show('data/12345678/12345678/12345678/12345678/12345678/12345'
439 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
440 '123456789-12.3456789.i')
441 show('data/12345678/12345678/12345678/12345678/12345678/12345'
442 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
443 '123456789-12.3456789-.i')
444 show('data/12345678/12345678/12345678/12345678/12345678/12345'
445 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
446 '123456789-12.3456789-1.i')
447 show('data/12345678/12345678/12345678/12345678/12345678/12345'
448 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
449 '123456789-12.3456789-12.i')
450 show('data/12345678/12345678/12345678/12345678/12345678/12345'
451 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
452 '123456789-12.3456789-123.i')
453 show('data/12345678/12345678/12345678/12345678/12345678/12345'
454 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
455 '123456789-12.3456789-1234.i')
456 show('data/12345678/12345678/12345678/12345678/12345678/12345'
457 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
458 '123456789-12.3456789-12345.i')
459 show('data/12345678/12345678/12345678/12345678/12345678/12345'
460 '678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
461 '123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWX'
462 'YZ-abcdefghjiklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPRSTU'
463 'VWXYZ-1234567890-xxxxxxxxx-xxxxxxxxx-xxxxxxxx-xxxx'
464 'xxxxx-wwwwwwwww-wwwwwwwww-wwwwwwwww-wwwwwwwww-wwww'
465 'wwwww-wwwwwwwww-wwwwwwwww-wwwwwwwww-wwwwwwwww.i')
776 def testextensionsreplicatedonhashedpaths(self):
777 # Extensions are replicated on hashed paths. Note that
778 # we only get to encode files that end in .i or .d inside the
779 # store. Encoded filenames are thus bound in length.
780 self.hybridencode(
781 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
782 b'12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3'
783 b'45.i'),
784 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12'
785 b'345678/12345/-xxxxxc10ad03b5755ed524f5286aab1815dfe07729438.i'))
786 self.hybridencode(
787 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
788 b'12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3'
789 b'45.d'),
790 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12'
791 b'345678/12345/-xxxxx9eec83381f2b39ef5ac8b4ecdf2c94f7983f57c8.d'))
792 self.hybridencode(
793 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
794 b'12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3'
795 b'456.i'),
796 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12'
797 b'345678/12345/-xxxxxb7796dc7d175cfb0bb8a7728f58f6ebec9042568.i'))
798 self.hybridencode(
799 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
800 b'12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3'
801 b'4567.i'),
802 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12'
803 b'345678/12345/-xxxxxb515857a6bfeef017c4894d8df42458ac65d55b8.i'))
804 self.hybridencode(
805 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
806 b'12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3'
807 b'45678.i'),
808 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12'
809 b'345678/12345/-xxxxxb05a0f247bc0a776211cd6a32ab714fd9cc09f2b.i'))
810 self.hybridencode(
811 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
812 b'12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3'
813 b'456789.i'),
814 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12'
815 b'345678/12345/-xxxxxf192b48bff08d9e0e12035fb52bc58c70de72c94.i'))
816 self.hybridencode(
817 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
818 b'12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3'
819 b'456789-.i'),
820 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12'
821 b'345678/12345/-xxxxx435551e0ed4c7b083b9ba83cee916670e02e80ad.i'))
822 self.hybridencode(
823 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
824 b'12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3'
825 b'456789-1.i'),
826 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12'
827 b'345678/12345/-xxxxxa7f74eb98d8d58b716356dfd26e2f9aaa65d6a9a.i'))
828 self.hybridencode(
829 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
830 b'12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3'
831 b'456789-12.i'),
832 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12'
833 b'345678/12345/-xxxxxed68d9bd43b931f0b100267fee488d65a0c66f62.i'))
834 self.hybridencode(
835 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
836 b'12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3'
837 b'456789-123.i'),
838 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12'
839 b'345678/12345/-xxxxx5cea44de2b642d2ba2b4a30693ffb1049644d698.i'))
840 self.hybridencode(
841 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
842 b'12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3'
843 b'456789-1234.i'),
844 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12'
845 b'345678/12345/-xxxxx68462f62a7f230b39c1b5400d73ec35920990b7e.i'))
846 self.hybridencode(
847 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
848 b'12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3'
849 b'456789-12345.i'),
850 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12'
851 b'345678/12345/-xxxxx4cb852a314c6da240a83eec94761cdd71c6ec22e.i'))
852 self.hybridencode(
853 (b'data/12345678/12345678/12345678/12345678/12345678/12345678/'
854 b'12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3'
855 b'456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-'
856 b'abcdefghjiklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPRSTUVWXYZ'
857 b'-1234567890-xxxxxxxxx-xxxxxxxxx-xxxxxxxx'
858 b'-xxxxxxxxx-wwwwwwwww-wwwwwwwww-wwwwwwwww-wwwwwwwww'
859 b'-wwwwwwwww-wwwwwwwww-wwwwwwwww-wwwwwwwww-wwwwwwwww.i'),
860 (b'dh/12345678/12345678/12345678/12345678/12345678/12345678/12'
861 b'345678/12345/-xxxxx93352aa50377751d9e5ebdf52da1e6e69a6887a6.i'))
466 862
467 print("paths outside data/ can be encoded")
468 show('metadata/dir/00manifest.i')
469 show('metadata/12345678/12345678/12345678/12345678/12345678/'
470 '12345678/12345678/12345678/12345678/12345678/12345678/'
471 '12345678/12345678/00manifest.i')
863 def testpathsoutsidedata(self):
864 # paths outside data/ can be encoded
865 self.hybridencode(b'metadata/dir/00manifest.i',
866 b'metadata/dir/00manifest.i')
867 self.hybridencode(
868 (b'metadata/12345678/12345678/12345678/12345678/12345678'
869 b'/12345678/12345678/12345678/12345678/12345678/12345678'
870 b'/12345678/12345678/00manifest.i'),
871 (b'dh/ata/12345678/12345678/12345678/12345678/12345678'
872 b'/12345678/12345678/00manife'
873 b'0a4da1f89aa2aa9eb0896eb451288419049781b4.i'))
874
875 if __name__ == '__main__':
876 import silenttestrunner
877 silenttestrunner.main(__name__)
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now