Add solaris xattr support to the tests.
authorWayne Davison <wayned@samba.org>
Tue, 20 Sep 2011 20:19:39 +0000 (13:19 -0700)
committerWayne Davison <wayned@samba.org>
Tue, 20 Sep 2011 20:24:42 +0000 (13:24 -0700)
Change the xattr case statements to use $HOST_OS.
(Slightly tweaked version of a Ben Walton patch.)

testsuite/chown.test
testsuite/devices.test
testsuite/xattrs.test

index 6f73a7094a17308459ae62cee996c882053d7836..30a3a94d46bba8dd5a029ef6eaf903d7d7c84145 100644 (file)
@@ -18,14 +18,25 @@ case $0 in
     $RSYNC --version | grep ", xattrs" >/dev/null || test_skipped "Rsync needs xattrs for fake device tests"
     RSYNC="$RSYNC --fake-super"
     TLS_ARGS="$TLS_ARGS --fake-super"
-    case "`xattr 2>&1 || true`" in
-    *--list:*)
+    case "$HOST_OS" in
+    darwin*)
        chown() {
            own=$1
            shift
            xattr -s 'rsync.%stat' "100644 0,0 $own" "${@}"
        }
        ;;
+    solaris*)
+       chown() {
+           own=$1
+           shift
+           for fn in "${@}"; do
+               runat "$fn" "$SHELL_PATH" <<EOF
+echo "100644 0,0 $own" > rsync.%stat
+EOF
+           done
+       }
+       ;;
     *)
        chown() {
            own=$1
index 1f6f068b3e4f211b93de578418adcd6e606e56b7..a92451382f50c6a369964dbe8d216318523b70d8 100644 (file)
@@ -19,8 +19,8 @@ case $0 in
     $RSYNC --version | grep ", xattrs" >/dev/null || test_skipped "Rsync needs xattrs for fake device tests"
     RSYNC="$RSYNC --fake-super"
     TLS_ARGS="$TLS_ARGS --fake-super"
-    case "`xattr 2>&1 || true`" in
-    *--list:*)
+    case "$HOST_OS" in
+    darwin*)
        mknod() {
            fn="$1"
            case "$2" in
@@ -34,6 +34,22 @@ case $0 in
            xattr -s 'rsync.%stat' "$mode $maj,$min 0:0" "$fn"
        }
        ;;
+    solaris*)
+       mknod() {
+           fn="$1"
+           case "$2" in
+           p) mode=10644 ;;
+           c) mode=20644 ;;
+           b) mode=60644 ;;
+           esac
+           maj="${3:-0}"
+           min="${4:-0}"
+           touch "$fn"
+           runat "$fn" "$SHELL_PATH" <<EOF
+echo "$mode $maj,$min 0:0" > rsync.%stat
+EOF
+       }
+       ;;
     *)
        mknod() {
            fn="$1"
index c1846df5c0fcb206f29573be490d7bc22a379a22..06afcba07a23ce485267aeeb4c4be34e3a2a23d2 100644 (file)
@@ -10,8 +10,8 @@ lnkdir="$tmpdir/lnk"
 
 $RSYNC --version | grep ", xattrs" >/dev/null || test_skipped "Rsync is configured without xattr support"
 
-case "`xattr 2>&1 || true`" in
-*--list:*)
+case "$HOST_OS" in
+darwin*)
     xset() {
        xnam="$1"
        xval="$2"
@@ -24,6 +24,27 @@ case "`xattr 2>&1 || true`" in
     RSYNC_PREFIX='rsync'
     RUSR='rsync.nonuser'
     ;;
+solaris*)
+    xset() {
+       xnam="$1"
+       xval="$2"
+       shift 2
+       for fn in "${@}"; do
+           runat "$fn" "$SHELL_PATH" <<EOF
+echo "${xval}" > "${xnam}"
+EOF
+       done
+    }
+    xls() {
+       for fn in "${@}"; do
+           runat "$fn" "$SHELL_PATH" <<EOF
+for x in *; do echo "\$x=\`cat \$x\`"; done
+EOF
+       done
+    }
+    RSYNC_PREFIX='rsync'
+    RUSR='rsync.nonuser'
+    ;;
 *)
     xset() {
        xnam="$1"