nspkg / removal_mount_test.v
18 lines · 16 sloc · 697 bytes · c01b0795d1db56c7bce2539b2c46b110637fdc1a
Raw
1module nspkg
2
3import nspkg.tests.signaturefixtures
4import os
5
6fn test_native_removal_keeps_mountpoints_and_reports_readonly_filesystems() ! {
7 $if linux {
8 base := os.join_path(os.temp_dir(), 'alpm-remove-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', 'removal_mount_probe.v')])!
14 output := signaturefixtures.command('timeout', ['20s', 'unshare', '--user', '--map-root-user',
15 '--mount', probe, base, os.readlink('/proc/self/ns/mnt')!])!
16 assert output.contains('native mountpoint and read-only removal verified')
17 }
18}
19