summaryrefslogtreecommitdiff
path: root/tests/touch
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/touch
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/touch')
-rwxr-xr-xtests/touch/60-seconds8
-rwxr-xr-xtests/touch/dangling-symlink8
-rwxr-xr-xtests/touch/dir-18
-rwxr-xr-xtests/touch/empty-file8
-rwxr-xr-xtests/touch/fail-diag8
-rwxr-xr-xtests/touch/fifo8
-rwxr-xr-xtests/touch/no-create-missing8
-rwxr-xr-xtests/touch/no-dereference8
-rwxr-xr-xtests/touch/no-rights8
-rwxr-xr-xtests/touch/not-owner8
-rwxr-xr-xtests/touch/now-owned-by-other8
-rwxr-xr-xtests/touch/obsolescent8
-rwxr-xr-xtests/touch/read-only8
-rwxr-xr-xtests/touch/relative8
-rwxr-xr-xtests/touch/trailing-slash8
15 files changed, 30 insertions, 90 deletions
diff --git a/tests/touch/60-seconds b/tests/touch/60-seconds
index e06c770f2..e50c25765 100755
--- a/tests/touch/60-seconds
+++ b/tests/touch/60-seconds
@@ -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
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
echo 60.000000000 > exp || framework_failure
diff --git a/tests/touch/dangling-symlink b/tests/touch/dangling-symlink
index 6847e460b..55466c439 100755
--- a/tests/touch/dangling-symlink
+++ b/tests/touch/dangling-symlink
@@ -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
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
rm -f touch-target t-symlink
ln -s touch-target t-symlink
diff --git a/tests/touch/dir-1 b/tests/touch/dir-1
index ef1543e26..2d61bb58f 100755
--- a/tests/touch/dir-1
+++ b/tests/touch/dir-1
@@ -2,12 +2,8 @@
# Make sure touch can operate on a directory.
# This was broken in the 4.0[efg] test releases.
-if test "$VERBOSE" = yes; then
- set -x
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
touch . || fail=1
Exit $fail
diff --git a/tests/touch/empty-file b/tests/touch/empty-file
index e279138b2..e93bf0ac0 100755
--- a/tests/touch/empty-file
+++ b/tests/touch/empty-file
@@ -21,12 +21,8 @@
# fails to work on SunOS 4.1.3 with `most of the recommended patches' when
# the empty file is on an NFS-mounted 4.2 volume.
-if test "$VERBOSE" = yes; then
- set -x
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
DEFAULT_SLEEP_SECONDS=2
SLEEP_SECONDS=${SLEEP_SECONDS=$DEFAULT_SLEEP_SECONDS}
diff --git a/tests/touch/fail-diag b/tests/touch/fail-diag
index 1b7acbc87..a957a8fdb 100755
--- a/tests/touch/fail-diag
+++ b/tests/touch/fail-diag
@@ -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
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
skip_if_root_
d1=no-$$
diff --git a/tests/touch/fifo b/tests/touch/fifo
index bf117d9ed..e6743d166 100755
--- a/tests/touch/fifo
+++ b/tests/touch/fifo
@@ -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
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
mkfifo_or_skip_ fifo
diff --git a/tests/touch/no-create-missing b/tests/touch/no-create-missing
index 7c47c6184..96aa09232 100755
--- a/tests/touch/no-create-missing
+++ b/tests/touch/no-create-missing
@@ -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
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
touch -c no-file > /dev/null 2>&1 || fail=1
diff --git a/tests/touch/no-dereference b/tests/touch/no-dereference
index 8d80fa5f5..95002e567 100755
--- a/tests/touch/no-dereference
+++ b/tests/touch/no-dereference
@@ -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
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
ln -s nowhere dangling || framework_failure
touch file || framework_failure
diff --git a/tests/touch/no-rights b/tests/touch/no-rights
index f0805e75d..d2032550b 100755
--- a/tests/touch/no-rights
+++ b/tests/touch/no-rights
@@ -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
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
# Make sure t2 is newer than t1.
touch -d '2000-01-01 00:00' t1 || framework_failure
diff --git a/tests/touch/not-owner b/tests/touch/not-owner
index 68eef1fa9..9645f4dbd 100755
--- a/tests/touch/not-owner
+++ b/tests/touch/not-owner
@@ -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
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
if env -- test -w /; then
skip_test_ you have write access to /.
diff --git a/tests/touch/now-owned-by-other b/tests/touch/now-owned-by-other
index b59f0d3bd..c7215022c 100755
--- a/tests/touch/now-owned-by-other
+++ b/tests/touch/now-owned-by-other
@@ -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
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
require_root_
group_num=$(id -g $NON_ROOT_USERNAME)
diff --git a/tests/touch/obsolescent b/tests/touch/obsolescent
index 3c0925b0f..9821fc1e4 100755
--- a/tests/touch/obsolescent
+++ b/tests/touch/obsolescent
@@ -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
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
_POSIX2_VERSION=199209; export _POSIX2_VERSION
POSIXLY_CORRECT=1; export POSIXLY_CORRECT
diff --git a/tests/touch/read-only b/tests/touch/read-only
index 06135c7b8..265f2880b 100755
--- a/tests/touch/read-only
+++ b/tests/touch/read-only
@@ -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
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
skip_if_root_
: > read-only || framework_failure
diff --git a/tests/touch/relative b/tests/touch/relative
index b9f8c2c92..7e56a305a 100755
--- a/tests/touch/relative
+++ b/tests/touch/relative
@@ -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
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
TZ=UTC0 touch --date='2004-01-16 12:00 +0000' f || framework_failure
diff --git a/tests/touch/trailing-slash b/tests/touch/trailing-slash
index c1fb8833e..97b910018 100755
--- a/tests/touch/trailing-slash
+++ b/tests/touch/trailing-slash
@@ -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
- touch --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && touch --version
ln -s nowhere dangling || framework_failure
ln -s loop loop || framework_failure