diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-12-27 03:45:09 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-12-27 04:14:00 +0900 |
| commit | 2e5362e536d477b47858748a8792c64175320aa7 (patch) | |
| tree | b4627f156649fbf74decae52b97237fd1e3ee40b /cmd/sharefs/test/test.py | |
| parent | 6d3bd27220c80eb58a11b75054fbbcf67e50cc28 (diff) | |
cmd/sharefs: opaque setup state
This allows unrestricted use of the type system and prepares setup code for cross-process initialisation.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd/sharefs/test/test.py')
| -rw-r--r-- | cmd/sharefs/test/test.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/sharefs/test/test.py b/cmd/sharefs/test/test.py index cd1d8972..8be70993 100644 --- a/cmd/sharefs/test/test.py +++ b/cmd/sharefs/test/test.py @@ -8,8 +8,8 @@ print(machine.succeed("/etc/sharefs -V")) machine.wait_for_unit("sharefs.service") machine.succeed("mkdir /mnt") -def check_bad_opts_output(opts, want, privileged=False): - output = machine.fail(("" if privileged else "sudo -u alice -i ") + f"/etc/sharefs -f -o source=/proc/nonexistent,{opts} /mnt 2>&1") +def check_bad_opts_output(opts, want, source="/etc", privileged=False): + output = machine.fail(("" if privileged else "sudo -u alice -i ") + f"/etc/sharefs -f -o source={source},{opts} /mnt 2>&1") if output != want: raise Exception(f"unexpected output: {output}") @@ -33,6 +33,11 @@ check_bad_opts_output("allow_other", "sharefs: setuid and setgid must not be 0\n check_bad_opts_output("setuid=1023", "sharefs: setuid and setgid must not be 0\n", privileged=True) check_bad_opts_output("setgid=1023", "sharefs: setuid and setgid must not be 0\n", privileged=True) +# Bad backing directory: +check_bad_opts_output("clone_fd", "sharefs: cannot open source: no such file or directory\n", source="/proc/nonexistent") +check_bad_opts_output("clone_fd", "sharefs: cannot open source: not a directory\n", source="/proc/self/exe") +check_bad_opts_output("clone_fd", "sharefs: cannot open source: permission denied\n", source="/root") + # Make sure nothing actually got mounted: machine.fail("umount /mnt") machine.succeed("rmdir /mnt") |
