Debian Codegraph @

testsuite/clean-fname-collapse_test.py

raw symbols SCIP
1 #!/usr/bin/env python3
2 # Regression test for KI-50: clean_fname(name, CFN_COLLAPSE_DOT_DOT_DIRS) must
3 # collapse ".." components. An off-by-one (*s=='/' should be s[-1]=='/'; s+1
4 # should be s) left the collapse dead for every multi-component/absolute path.
5 # The t_clean_fname helper links the real util1.o and checks the collapse.
6
7 import subprocess
8
9 from rsyncfns import TOOLDIR, test_fail, test_skipped
10
11 helper = TOOLDIR / 't_clean_fname'
12 if not helper.is_file():
13 test_skipped("t_clean_fname helper not built")
14
15 proc = subprocess.run([str(helper)], stdout=subprocess.PIPE, stderr=subprocess.PIPE,
16 timeout=30)
17 if proc.returncode != 0:
18 test_fail("clean_fname CFN_COLLAPSE_DOT_DOT_DIRS off-by-one (collapse dead)\n"
19 + (proc.stdout or b'').decode('utf-8', 'replace')
20 + (proc.stderr or b'').decode('utf-8', 'replace'))
21 print((proc.stdout or b'').decode('utf-8', 'replace').strip())