From 3669d2b820601ff029f94c045168a9fdbd472e57 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 24 Nov 2007 10:57:05 +0100 Subject: Tweak new test. * tests/cp/preserve-gid: Split some long lines. Prepend "+" to numeric uid and gid chown arguments, on principle. Use skip_test_. --- tests/cp/preserve-gid | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/cp/preserve-gid b/tests/cp/preserve-gid index c1ecb7fff..5f2c05024 100755 --- a/tests/cp/preserve-gid +++ b/tests/cp/preserve-gid @@ -22,7 +22,7 @@ PRIV_CHECK_ARG=require-root . "$srcdir/../priv-check" create() { echo "$1" > "$1" || exit 1 - chown "$2:$3" "$1" || exit 1 + chown "+$2:+$3" "$1" || exit 1 } t0() { @@ -42,7 +42,8 @@ t1() { f=$1; shift u=$1; shift g=$1; shift - t0 "$f" "$u" "$g" setuidgid -g "$nameless_gid1,$nameless_gid2" "$nameless_uid" "$@" + t0 "$f" "$u" "$g" setuidgid -g "$nameless_gid1,$nameless_gid2" \ + "$nameless_uid" "$@" } if test "x$VERBOSE" = xyes; then @@ -50,16 +51,17 @@ if test "x$VERBOSE" = xyes; then cp --version fi -nameless_uid=`$PERL -e 'foreach my $i (1000..16*1024-1) { getpwuid $i or (print "$i\n"), exit }'` -nameless_gid1=`$PERL -e 'foreach my $i (1000..16*1024) { getgrgid $i or (print "$i\n"), exit }'` -nameless_gid2=`$PERL -e 'foreach my $i ('"$nameless_gid1"'+1..16*1024) { getgrgid $i or (print "$i\n"), exit }'` +nameless_uid=`$PERL -le 'foreach my $i (1000..16*1024-1) { getpwuid $i or (print $i), exit }'` +nameless_gid1=`$PERL -le 'foreach my $i (1000..16*1024) { getgrgid $i or (print $i), exit }'` +nameless_gid2=`$PERL -le 'foreach my $i ('"$nameless_gid1"'+1..16*1024) { getgrgid $i or (print $i), exit }'` -if [ -z "$nameless_uid" ] || [ -z "$nameless_gid1" ] || [ -z "$nameless_gid2" ]; then - echo "$0: couldn't find a nameless UID or GID" 1>&2 - (exit 77); exit 77 +if test -z "$nameless_uid" \ + || test -z "$nameless_gid1" \ + || test -z "$nameless_gid2"; then + skip_test_ "couldn't find a nameless UID or GID" fi -chown "$nameless_uid" . +chown "+$nameless_uid" . create a0 0 0 create b0 "$nameless_uid" "$nameless_gid1" -- cgit v1.2.3-70-g09d2