Debian Codegraph @

testsuite/operator-path-write-batch_test.py

raw symbols SCIP
1 #!/usr/bin/env python3
2 # --write-batch symlink policy matrix (batch.c open site, shared with
3 # --read-batch / --only-write-batch). Already refuses a foreign-owned symlink
4 # but does not honor --insecure-links -- RED on the insecure cells.
5
6 import subprocess
7
8 from rsyncfns import rsync_argv, run_symlink_matrix, plant_operator_symlink
9
10
11 def case(ctx):
12 src = ctx.base / 'src'
13 dest = ctx.base / 'dest'
14 src.mkdir()
15 dest.mkdir()
16 (src / 'f0').write_text("data\n")
17 opt, victim = plant_operator_symlink(ctx, ctx.base, kind='file')
18 extra = ['--insecure-links'] if ctx.insecure else []
19 subprocess.run(
20 rsync_argv('-a', f'--write-batch={opt}', *extra, 'src/', 'dest/'),
21 cwd=str(ctx.base), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
22 # Followed == the batch file was written through the symlink, out-of-tree.
23 return victim.is_file()
24
25
26 run_symlink_matrix('--write-batch', case)
27 print("--write-batch symlink policy matrix: enforced")