Debian Codegraph @

testsuite/longdir_test.py

raw symbols SCIP
1 #!/usr/bin/env python3
2 # Python rewrite of testsuite/longdir.test.
3 #
4 # Regression test for a 2.0.11 bug: rsync used to mishandle paths nested
5 # inside a stupidly-long directory name. We build a three-deep nest of
6 # 175-char directory names, drop a couple of files in the leaf, and
7 # verify that --delete -avH still produces an identical destination.
8
9 from rsyncfns import (FROMDIR, TODIR, checkit, hands_setup, make_text_file,
10 test_skipped)
11
12
13 hands_setup()
14
15 longname = ('This-is-a-directory-with-a-stupidly-long-name-created-in-an-'
16 'attempt-to-provoke-an-error-found-in-2.0.11-that-should-'
17 'hopefully-never-appear-again-if-this-test-does-its-job')
18 longdir = FROMDIR / longname / longname / longname
19
20 try:
21 longdir.mkdir(parents=True)
22 except OSError:
23 test_skipped("unable to create long directory")
24
25 try:
26 (longdir / '1').touch()
27 except OSError:
28 test_skipped("unable to create files in long directory")
29
30 # Drop predictable, self-contained content into the two leaf files.
31 make_text_file(longdir / '1', 50)
32 make_text_file(longdir / '2', 100)
33
34 checkit(['--delete', '-avH', f'{FROMDIR}/', str(TODIR)], FROMDIR, TODIR)