summaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-08-13 10:02:29 -0400
committerTavian Barnes <tavianator@tavianator.com>2020-08-13 10:14:29 -0400
commit564142a029fda86b2d87f8f39c12acea34241098 (patch)
tree802a8225cacfc1d9f8ba80c0959651353f728325 /tests.sh
parent6a4c2677075adca143fa8501096a2a59499503b5 (diff)
downloadbfs-564142a029fda86b2d87f8f39c12acea34241098.tar.xz
Implement -xattrname
From macOS find.
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh77
1 files changed, 57 insertions, 20 deletions
diff --git a/tests.sh b/tests.sh
index 88b6988..bbc823d 100755
--- a/tests.sh
+++ b/tests.sh
@@ -695,12 +695,18 @@ case "$UNAME" in
bsd_tests+=(
test_xattr
test_L_xattr
+
+ test_xattrname
+ test_L_xattrname
)
;;
*)
sudo_tests+=(
test_xattr
test_L_xattr
+
+ test_xattrname
+ test_L_xattrname
)
;;
esac
@@ -2562,53 +2568,84 @@ function test_L_capable() {
bfs_diff -L scratch -capable
}
-function set_xattr() {
+function make_xattrs() {
+ rm -rf scratch/*
+
+ touch scratch/{normal,xattr,xattr_2}
+ ln -s xattr scratch/link
+ ln -s normal scratch/xattr_link
+
case "$UNAME" in
Darwin)
- xattr -w bfs_test true "$1"
- xattr -s -w bfs_test true "$2"
+ xattr -w bfs_test true scratch/xattr
+ xattr -w bfs_test_2 true scratch/xattr_2
+ xattr -s -w bfs_test true scratch/xattr_link
;;
FreeBSD)
- setextattr user bfs_test true "$1"
- setextattr -h user bfs_test true "$2"
+ setextattr user bfs_test true scratch/xattr
+ setextattr user bfs_test_2 true scratch/xattr_2
+ setextattr -h user bfs_test true scratch/xattr_link
;;
*)
# Linux tmpfs doesn't support the user.* namespace, so we use the security.*
# namespace, which is writable by root and readable by others
- sudo setfattr -n security.bfs_test "$1"
- sudo setfattr -h -n security.bfs_test "$2"
+ sudo setfattr -n security.bfs_test scratch/xattr
+ sudo setfattr -n security.bfs_test_2 scratch/xattr_2
+ sudo setfattr -h -n security.bfs_test scratch/xattr_link
;;
esac
}
function test_xattr() {
- rm -rf scratch/*
-
if ! invoke_bfs scratch -quit -xattr 2>/dev/null; then
return 0
fi
- touch scratch/{normal,xattr}
- ln -s xattr scratch/link
- ln -s normal scratch/xattr_link
- set_xattr scratch/xattr scratch/xattr_link
-
+ make_xattrs
bfs_diff scratch -xattr
}
function test_L_xattr() {
- rm -rf scratch/*
+ if ! invoke_bfs scratch -quit -xattr 2>/dev/null; then
+ return 0
+ fi
+ make_xattrs
+ bfs_diff -L scratch -xattr
+}
+
+function test_xattrname() {
if ! invoke_bfs scratch -quit -xattr 2>/dev/null; then
return 0
fi
- touch scratch/{normal,xattr}
- ln -s xattr scratch/link
- ln -s normal scratch/xattr_link
- set_xattr scratch/xattr scratch/xattr_link
+ make_xattrs
- bfs_diff -L scratch -xattr
+ case "$UNAME" in
+ Darwin|FreeBSD)
+ bfs_diff scratch -xattrname bfs_test
+ ;;
+ *)
+ bfs_diff scratch -xattrname security.bfs_test
+ ;;
+ esac
+}
+
+function test_L_xattrname() {
+ if ! invoke_bfs scratch -quit -xattr 2>/dev/null; then
+ return 0
+ fi
+
+ make_xattrs
+
+ case "$UNAME" in
+ Darwin|FreeBSD)
+ bfs_diff -L scratch -xattrname bfs_test
+ ;;
+ *)
+ bfs_diff -L scratch -xattrname security.bfs_test
+ ;;
+ esac
}
function test_help() {