summaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-01-07 10:36:33 -0500
committerTavian Barnes <tavianator@tavianator.com>2020-01-07 10:36:33 -0500
commit3fa560ca6e0d68938f71ed1984f63f8c5cb7e7cc (patch)
treee27913a1146b563d2fe202a289e326ef9071b2de /tests.sh
parent8644e0e5ce28b662a0b4e4b19351a38be5fa6681 (diff)
downloadbfs-3fa560ca6e0d68938f71ed1984f63f8c5cb7e7cc.tar.xz
fsade: Support NFSv4 ACLs on FreeBSD
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh34
1 files changed, 20 insertions, 14 deletions
diff --git a/tests.sh b/tests.sh
index 3b05bf6..900cf4e 100755
--- a/tests.sh
+++ b/tests.sh
@@ -2391,19 +2391,31 @@ function test_xtype_bind_mount() {
return $ret
}
+function set_acl() {
+ uname="$(uname)"
+
+ if [ "$uname" = "Darwin" ]; then
+ chmod +a "$(id -un) allow read,write" "$1"
+ elif [ "$uname" = "FreeBSD" ]; then
+ if [ "$(getconf ACL_EXTENDED "$1")" -gt 0 ]; then
+ setfacl -m "u:$(id -un):rw" "$1"
+ elif [ "$(getconf ACL_NFS4 "$1")" -gt 0 ]; then
+ setfacl -m "u:$(id -un):rw::allow" "$1"
+ else
+ return 1
+ fi
+ else
+ return 1
+ fi
+}
+
function test_acl() {
rm -rf scratch/*
invoke_bfs scratch -quit -acl 2>/dev/null || return 0
touch scratch/{normal,acl}
-
- if [ "$(uname)" = "Darwin" ]; then
- chmod +a "$(id -un) allow read,write" scratch/acl || return 0
- else
- setfacl -m "u:$(id -un):rw" scratch/acl || return 0
- fi
-
+ set_acl scratch/acl || return 0
ln -s acl scratch/link
bfs_diff scratch -acl
@@ -2415,13 +2427,7 @@ function test_L_acl() {
invoke_bfs scratch -quit -acl 2>/dev/null || return 0
touch scratch/{normal,acl}
-
- if [ "$(uname)" = "Darwin" ]; then
- chmod +a "$(id -un) allow read,write" scratch/acl || return 0
- else
- setfacl -m "u:$(id -un):rw" scratch/acl || return 0
- fi
-
+ set_acl scratch/acl || return 0
ln -s acl scratch/link
bfs_diff -L scratch -acl