Debian Codegraph @

testsuite/iwildmatch-fold_test.py

raw symbols SCIP
1 #!/usr/bin/env python3
2 # Regression test for KI-53: iwildmatch() must fold case on BOTH the text and the
3 # pattern. The old dowild() folded only the text char, so an upper-case pattern
4 # token (e.g. a daemon "hosts deny = *.BADDOMAIN.COM") failed to match a
5 # lower-case host -> access-control fail-open. The t_iwildmatch helper links the
6 # real lib/wildmatch.o and exercises the fold both ways.
7
8 import subprocess
9
10 from rsyncfns import TOOLDIR, test_fail, test_skipped
11
12 helper = TOOLDIR / 't_iwildmatch'
13 if not helper.is_file():
14 test_skipped("t_iwildmatch helper not built")
15
16 proc = subprocess.run([str(helper)], stdout=subprocess.PIPE, stderr=subprocess.PIPE,
17 timeout=30)
18 if proc.returncode != 0:
19 test_fail("iwildmatch case-fold is asymmetric (pattern not folded)\n"
20 + (proc.stdout or b'').decode('utf-8', 'replace')
21 + (proc.stderr or b'').decode('utf-8', 'replace'))
22 print((proc.stdout or b'').decode('utf-8', 'replace').strip())