]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid false failures on AIX
authorPádraig Brady <P@draigBrady.com>
Fri, 4 Aug 2017 04:20:08 +0000 (21:20 -0700)
committerPádraig Brady <P@draigBrady.com>
Mon, 14 Aug 2017 04:33:01 +0000 (21:33 -0700)
* tests/ln/sf-1.sh: Limit the symlink size to 1MiB
to avoid memory exhaustion seen on NFS on AIX, giving:
  + printf '%0*d' 4294967296 0
  + ./tests/ln/sf-1.sh: line 38: printf: warning: 0: Result too large
* tests/id/setgid.sh: Skip the test when the adjusted gid
would equal 4294967295, as that's reserved on AIX.
Reported by Michael Felt.

tests/id/setgid.sh
tests/ln/sf-1.sh

index 61a1d993f504889dc6915a28cac7e40412489c57..09f9eb0f5c1777bcbefba951d8b84e512675349e 100755 (executable)
 print_ver_ id
 require_root_
 
+getlimits_
+
 # Construct a different group number
 gp1=$NON_ROOT_GID
 gp1=$(expr $gp1 + 1) ||
   skip_ "failed to adjust GID $NON_ROOT_GID"
 
+test "$gp1" -lt $GID_T_MAX ||
+  skip_ "GID $gp1 is reserved on some systems"
+
 echo $gp1 > exp || framework_failure_
 
 # With coreutils-8.16 and earlier, id -G would print both:
index 149b27569755876f70078cf8b54063f0d1a20d31..492fce9035423286262ec9e447ce45fc812bebc5 100755 (executable)
@@ -33,9 +33,14 @@ esac
 
 # Ensure we replace symlinks that don't or can't link to an existing target.
 # coreutils-8.22 would fail to replace {ENOTDIR,ELOOP,ENAMETOOLONG}_link below.
-name_max_plus1=$(expr $(stat -f -c %l .) + 1)
+name_max=$(stat -f -c %l .) || skip_ 'Error determining NAME_MAX'
+# Apply a limit since AIX returns 2^32-1 which would trigger resource issues.
+name_limit=$((1024*1024))
+test "$name_max" -lt "$name_limit" || name_max="$name_limit"
+name_max_plus1=$(expr $name_max + 1)
 test $name_max_plus1 -gt 1 || skip_ 'Error determining NAME_MAX'
 long_name=$(printf '%0*d' $name_max_plus1 0)
+
 for f in '' f; do
   ln -s$f missing ENOENT_link || fail=1
   ln -s$f a/b ENOTDIR_link || fail=1