summaryrefslogtreecommitdiff
path: root/tests/chown
diff options
context:
space:
mode:
Diffstat (limited to 'tests/chown')
-rw-r--r--tests/chown/Makefile.am2
-rwxr-xr-xtests/chown/basic19
-rwxr-xr-xtests/chown/deref22
-rwxr-xr-xtests/chown/preserve-root20
-rwxr-xr-xtests/chown/separator33
5 files changed, 22 insertions, 74 deletions
diff --git a/tests/chown/Makefile.am b/tests/chown/Makefile.am
index 61e65818f..e0017c1be 100644
--- a/tests/chown/Makefile.am
+++ b/tests/chown/Makefile.am
@@ -8,3 +8,5 @@ EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH"
+
+include $(top_srcdir)/tests/check.mk
diff --git a/tests/chown/basic b/tests/chown/basic
index 668e39d68..a4276b8de 100755
--- a/tests/chown/basic
+++ b/tests/chown/basic
@@ -1,7 +1,7 @@
#!/bin/sh
# make sure chown --from=... works
-# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2004-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,24 +21,11 @@ if test "$VERBOSE" = yes; then
chgrp --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-tmp=basic.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch f || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework' 1>&2
- (exit 1); exit 1
-fi
+touch f || framework_failure
fail=0
chown -R --preserve-root 0:1 f
diff --git a/tests/chown/deref b/tests/chown/deref
index 9da201325..74684fe6a 100755
--- a/tests/chown/deref
+++ b/tests/chown/deref
@@ -2,7 +2,7 @@
# For coreutils-5.2.1 and earlier, chown --dereference would skip
# symlinks having owner/group matching the specified owner/group.
-# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,23 +22,10 @@ if test "$VERBOSE" = yes; then
chown --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
+. $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
-ln -s no-such dangle || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+ln -s no-such dangle || framework_failure
fail=0
@@ -52,7 +39,6 @@ cat <<\EOF > exp || fail=1
chown: cannot dereference `dangle'
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
diff --git a/tests/chown/preserve-root b/tests/chown/preserve-root
index 6889fa579..de45cbc16 100755
--- a/tests/chown/preserve-root
+++ b/tests/chown/preserve-root
@@ -1,7 +1,7 @@
#!/bin/sh
# Verify that --preserve-root works.
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,25 +21,12 @@ if test "$VERBOSE" = yes; then
chown --version
fi
-. $srcdir/../envvar-check
. $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 && ln -s / d/slink-to-root
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
fail=0
# Even if --preserve-root were to malfunction, allowing the chown or
@@ -80,7 +67,6 @@ chgrp: it is dangerous to operate recursively on `d/slink-to-root' (same as `/')
chgrp: use --no-preserve-root to override this failsafe
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
diff --git a/tests/chown/separator b/tests/chown/separator
index 991589735..de33831a9 100755
--- a/tests/chown/separator
+++ b/tests/chown/separator
@@ -1,7 +1,7 @@
#!/bin/sh
# Make sure "chown USER:GROUP FILE" works, and similar tests with separators.
-# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2004-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,32 +21,19 @@ if test "$VERBOSE" = yes; then
chown --version
fi
-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 'status=$?; (exit $status); exit $status' 1 2 13 15
+. $srcdir/../test-lib.sh
-framework_failure=0
+id_u=`id -u` || framework_failure
+test -n "$id_u" || framework_failure
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
+id_un=`id -un` || framework_failure
+test -n "$id_un" || framework_failure
-id_u=`id -u` || framework_failure=1
-test -n "$id_u" || framework_failure=1
+id_g=`id -g` || framework_failure
+test -n "$id_g" || framework_failure
-id_un=`id -un` || framework_failure=1
-test -n "$id_un" || framework_failure=1
-
-id_g=`id -g` || framework_failure=1
-test -n "$id_g" || framework_failure=1
-
-id_gn=`id -gn` || framework_failure=1
-test -n "$id_gn" || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 77); exit 77
-fi
+id_gn=`id -gn` || framework_failure
+test -n "$id_gn" || framework_failure
fail=0