From df0beae1eb1318869d51a064aec8fdd401877cbf Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 6 Sep 2007 17:34:49 +0200 Subject: Adjust chgrp, chmod, chown, cp tests to use test-lib.sh. * tests/check.mk: Also define abs_top_builddir. --- tests/cp/fail-perm | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'tests/cp/fail-perm') diff --git a/tests/cp/fail-perm b/tests/cp/fail-perm index 31b4cb3ad..0ed9166f4 100755 --- a/tests/cp/fail-perm +++ b/tests/cp/fail-perm @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006 Free Software +# Copyright (C) 2000, 2002-2007 Free Software # Foundation, Inc. # This program is free software: you can redistribute it and/or modify @@ -23,25 +23,12 @@ fi . $srcdir/../lang-default PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check +. $srcdir/../test-lib.sh -pwd=`pwd` -t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$ -trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0 -trap '(exit $?); exit' 1 2 13 15 - -framework_failure=0 -mkdir -p $tmp || framework_failure=1 -cd $tmp || framework_failure=1 - -mkdir D D/D || framework_failure=1 -touch D/a || framework_failure=1 -chmod 0 D/a || framework_failure=1 -chmod u=rx,go=,-st D || framework_failure=1 - -if test $framework_failure = 1; then - echo 'failure in testing framework' - exit 1 -fi +mkdir D D/D || framework_failure +touch D/a || framework_failure +chmod 0 D/a || framework_failure +chmod u=rx,go=,-st D || framework_failure fail=0 @@ -66,11 +53,11 @@ cp F symlink 2> out && fail=1 # ...: The file access permissions do not allow the specified action. # to the expected one: sed 's/: The file access permissions.*/: Permission denied/'o1;mv o1 out -cmp out exp || { (diff -c out exp) 2> /dev/null; fail=1; } +compare out exp || fail=1 cp --target-directory=symlink F 2> out && fail=1 sed 's/: The file access permissions.*/: Permission denied/'o1;mv o1 out -cmp out exp || { (diff -c out exp) 2> /dev/null; fail=1; } +compare out exp || fail=1 chmod 700 D -- cgit v1.2.3-70-g09d2