Unify tests that set gl_cv_func_frexp_no_libm.
[gnulib.git] / tests / test-copy-acl.sh
index ba81e12..a16990b 100755 (executable)
@@ -3,6 +3,12 @@
 # Show all commands when run with environment variable VERBOSE=yes.
 test -z "$VERBOSE" || set -x
 
+test "$USE_ACL" = 0 &&
+  {
+    echo "Skipping test: insufficient ACL support"
+    exit 77
+  }
+
 # func_tmpdir
 # creates a temporary directory.
 # Sets variable
@@ -181,17 +187,23 @@ cd "$builddir" ||
   func_test_copy tmpfile0 tmpfile1
 
   if test $acl_flavor != none; then
+    # A POSIX compliant 'id' program.
+    if test -f /usr/xpg4/bin/id; then
+      ID=/usr/xpg4/bin/id
+    else
+      ID=id
+    fi
     # Use a user and group id different from the current one, to avoid
     # redundant/ambiguous ACLs.
-    myuid=`id -u`
-    mygid=`id -g`
+    myuid=`$ID -u`
+    mygid=`$ID -g`
     auid=1
     if test "$auid" = "$myuid"; then auid=2; fi
     agid=1
     if test "$agid" = "$mygid"; then agid=2; fi
 
     case $acl_flavor in
-      linux | cygwin | freebsd | solaris)
+      linux | freebsd | solaris)
 
         # Set an ACL for a user.
         setfacl -m user:$auid:1 tmpfile0
@@ -265,6 +277,43 @@ cd "$builddir" ||
 
         ;;
 
+      cygwin)
+
+        # Set an ACL for a group.
+        setfacl -m group:0:1 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile2
+
+        # Set an ACL for other.
+        setfacl -m other:4 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile4
+
+        # Remove the ACL for the group.
+        setfacl -d group:0 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile5
+
+        # Remove the ACL for other.
+        setfacl -d other:4 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile6
+
+        # Delete all optional ACLs.
+        setfacl -s user::6,group::0,other:0 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile8
+
+        # Copy ACLs from a file that has no ACLs.
+        echo > tmpfile9
+        chmod a+x tmpfile9
+        getfacl tmpfile9 | setfacl -f - tmpfile0
+        rm -f tmpfile9
+
+        func_test_copy tmpfile0 tmpfile9
+
+        ;;
+
       hpux)
 
         # Set an ACL for a user.