| 1 | module nspkg |
| 2 | |
| 3 | import nspkg.tests.signaturefixtures |
| 4 | import os |
| 5 | |
| 6 | fn test_native_file_preflight_handles_cyclic_directory_mounts() ! { |
| 7 | $if linux { |
| 8 | base := os.join_path(os.temp_dir(), 'alpm-file-conflict-mounts-${os.getpid()}') |
| 9 | os.mkdir_all(base)! |
| 10 | defer { os.rmdir_all(base) or { eprintln(err) } } |
| 11 | probe := os.join_path(base, 'probe') |
| 12 | signaturefixtures.command('v', ['-o', probe, |
| 13 | os.join_path(@VMODROOT, 'tests', 'file_conflict_mount_probe.v')])! |
| 14 | dependencies := signaturefixtures.command('ldd', [probe])! |
| 15 | assert !dependencies.contains('libalpm') |
| 16 | output := signaturefixtures.command('timeout', ['20s', 'unshare', '--user', '--map-root-user', |
| 17 | '--mount', probe, base, os.readlink('/proc/self/ns/mnt')!])! |
| 18 | assert output.contains('native file preflight rejects cyclic bind mounts without mutation') |
| 19 | } |
| 20 | } |
| 21 | |