summaryrefslogtreecommitdiff
path: root/tests/chown
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-11-14 11:05:05 +0100
committerJim Meyering <meyering@redhat.com>2010-11-17 20:48:57 +0100
commitf38becab02472e6872048a1951b249b2a3c054df (patch)
treee5b531384b55abae8b1829ada892891bfee58fe3 /tests/chown
parent30b74dfff16240ea0e4a4c5b705f1e9631e5d0a7 (diff)
downloadcoreutils-f38becab02472e6872048a1951b249b2a3c054df.tar.xz
tests: convert first batch of tests from test-lib.sh to init.sh
Initially, I did this, git grep -l srcdir/test-lib.sh|xargs perl -p0i -e '~180-byte script' but that line would have been much longer than the maximum permitted by coreutils' commit hook, and wasn't readable besides, so here's a more readable version: lhs=$(printf '%s\\n' \ 'if test "$VERBOSE" = yes; then' \ ' set -x' \ ' touch --version' \ 'fi' \ '' \ '. $srcdir/test-lib.sh' \ | sed 's/\$/\\\$/g;s/touch/(\\w+)/') rhs=$(printf '%s\\n' \ '. "${srcdir=.}/init.sh"; path_prepend_ ../src' \ 'test "$VERBOSE" = yes && FIXME --version' \ | sed 's/\$/\\\$/g;s/FIXME/\$1/') git grep -l srcdir/test-lib.sh|xargs perl -p0i -e "s,$lhs,$rhs,"
Diffstat (limited to 'tests/chown')
-rwxr-xr-xtests/chown/basic8
-rwxr-xr-xtests/chown/deref8
-rwxr-xr-xtests/chown/preserve-root8
-rwxr-xr-xtests/chown/separator8
4 files changed, 8 insertions, 24 deletions
diff --git a/tests/chown/basic b/tests/chown/basic
index f161b536b..3ad43b403 100755
--- a/tests/chown/basic
+++ b/tests/chown/basic
@@ -16,12 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if test "$VERBOSE" = yes; then
- set -x
- chgrp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && chgrp --version
require_root_
touch f || framework_failure
diff --git a/tests/chown/deref b/tests/chown/deref
index 7a269e756..85603b429 100755
--- a/tests/chown/deref
+++ b/tests/chown/deref
@@ -17,12 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if test "$VERBOSE" = yes; then
- set -x
- chown --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && chown --version
ln -s no-such dangle || framework_failure
diff --git a/tests/chown/preserve-root b/tests/chown/preserve-root
index 81483db5b..c01149629 100755
--- a/tests/chown/preserve-root
+++ b/tests/chown/preserve-root
@@ -16,12 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if test "$VERBOSE" = yes; then
- set -x
- chown --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && chown --version
skip_if_root_
mkdir d && ln -s / d/slink-to-root
diff --git a/tests/chown/separator b/tests/chown/separator
index 4c204f126..914d9cca4 100755
--- a/tests/chown/separator
+++ b/tests/chown/separator
@@ -16,12 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if test "$VERBOSE" = yes; then
- set -x
- chown --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && chown --version
id_u=`id -u` || framework_failure
test -n "$id_u" || framework_failure