[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#7400: tests: get rid of test-lib.sh: use gnulib's init.sh instead
From: |
Jim Meyering |
Subject: |
bug#7400: tests: get rid of test-lib.sh: use gnulib's init.sh instead |
Date: |
Sun, 14 Nov 2010 18:03:24 +0100 |
This series converts all test-lib.sh-using tests to use init.sh instead.
I've elided the all-mechanical diffs from the two largest ones,
so don't try to apply those.
>From 35014f16b3b85f77becb01fdccde3160399bcfc7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 14 Nov 2010 11:01:25 +0100
Subject: [PATCH 1/5] tests: move a comment so automated conversion works
---
tests/tail-2/assert | 3 ++-
tests/tail-2/assert-2 | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tests/tail-2/assert b/tests/tail-2/assert
index c164eee..08cd888 100755
--- a/tests/tail-2/assert
+++ b/tests/tail-2/assert
@@ -28,8 +28,9 @@ if test "$VERBOSE" = yes; then
tail --version
fi
-# Not "expensive" per se, but sleeping for so long is annoying.
. $srcdir/test-lib.sh
+
+# Not "expensive" per se, but sleeping for so long is annoying.
very_expensive_
ok='ok ok ok'
diff --git a/tests/tail-2/assert-2 b/tests/tail-2/assert-2
index 7e039ff..066d6af 100755
--- a/tests/tail-2/assert-2
+++ b/tests/tail-2/assert-2
@@ -23,8 +23,9 @@ if test "$VERBOSE" = yes; then
tail --version
fi
-# Not "expensive" per se, but sleeping for so long is annoying.
. $srcdir/test-lib.sh
+
+# Not "expensive" per se, but sleeping for so long is annoying.
very_expensive_
ok='ok ok ok'
--
1.7.3.2.4.g60aa9
>From a1272b23fe3693f33f2ae4234a3ab1968a6965c4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 14 Nov 2010 11:05:05 +0100
Subject: [PATCH 2/5] 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,"
---
tests/chgrp/basic | 8 ++------
tests/chgrp/default-no-deref | 8 ++------
tests/chgrp/deref | 8 ++------
tests/chgrp/no-x | 8 ++------
tests/chgrp/posix-H | 8 ++------
tests/chgrp/recurse | 8 ++------
tests/chmod/c-option | 8 ++------
tests/chmod/equal-x | 8 ++------
tests/chmod/equals | 8 ++------
tests/chmod/inaccessible | 8 ++------
tests/chmod/no-x | 8 ++------
tests/chmod/octal | 8 ++------
tests/chmod/setgid | 8 ++------
tests/chmod/thru-dangling | 8 ++------
tests/chmod/umask-x | 8 ++------
tests/chmod/usage | 8 ++------
tests/chown/basic | 8 ++------
tests/chown/deref | 8 ++------
tests/chown/preserve-root | 8 ++------
tests/chown/separator | 8 ++------
tests/cp/abuse | 8 ++------
tests/cp/backup-1 | 8 ++------
tests/cp/backup-dir | 8 ++------
tests/cp/backup-is-src | 8 ++------
tests/cp/capability | 8 ++------
tests/cp/cp-HL | 8 ++------
tests/cp/cp-a-selinux | 8 ++------
tests/cp/cp-deref | 8 ++------
tests/cp/cp-i | 8 ++------
tests/cp/cp-parents | 8 ++------
tests/cp/deref-slink | 8 ++------
tests/cp/dir-rm-dest | 8 ++------
tests/cp/dir-slash | 8 ++------
tests/cp/dir-vs-file | 8 ++------
tests/cp/existing-perm-race | 8 ++------
tests/cp/fail-perm | 8 ++------
tests/cp/file-perm-race | 8 ++------
tests/cp/into-self | 8 ++------
tests/cp/link | 8 ++------
tests/cp/link-heap | 8 ++------
tests/cp/link-no-deref | 8 ++------
tests/cp/link-preserve | 8 ++------
tests/cp/no-deref-link1 | 8 ++------
tests/cp/no-deref-link2 | 8 ++------
tests/cp/no-deref-link3 | 8 ++------
tests/cp/parent-perm | 8 ++------
tests/cp/parent-perm-race | 8 ++------
tests/cp/preserve-2 | 8 ++------
tests/cp/preserve-slink-time | 8 ++------
tests/cp/proc-short-read | 8 ++------
tests/cp/proc-zero-len | 8 ++------
tests/cp/r-vs-symlink | 8 ++------
tests/cp/reflink-auto | 8 ++------
tests/cp/reflink-perm | 8 ++------
tests/cp/same-file | 8 ++------
tests/cp/slink-2-slink | 8 ++------
tests/cp/sparse | 8 ++------
tests/cp/special-bits | 8 ++------
tests/cp/special-f | 8 ++------
tests/cp/src-base-dot | 8 ++------
tests/cp/symlink-slash | 8 ++------
tests/cp/thru-dangling | 8 ++------
tests/dd/direct | 8 ++------
tests/dd/misc | 8 ++------
tests/dd/not-rewound | 8 ++------
tests/dd/reblock | 8 ++------
tests/dd/skip-seek-past-dev | 8 ++------
tests/dd/skip-seek-past-file | 8 ++------
tests/dd/skip-seek2 | 8 ++------
tests/dd/stderr | 8 ++------
tests/dd/unblock-sync | 8 ++------
tests/df/total-verify | 8 ++------
tests/df/unreadable | 8 ++------
tests/du/2g | 8 ++------
tests/du/8gb | 8 ++------
tests/du/basic | 8 ++------
tests/du/deref | 8 ++------
tests/du/deref-args | 8 ++------
tests/du/exclude | 8 ++------
tests/du/fd-leak | 8 ++------
tests/du/hard-link | 8 ++------
tests/du/inacc-dest | 8 ++------
tests/du/inacc-dir | 8 ++------
tests/du/inaccessible-cwd | 8 ++------
tests/du/long-from-unreadable | 8 ++------
tests/du/long-sloop | 8 ++------
tests/du/no-deref | 8 ++------
tests/du/no-x | 8 ++------
tests/du/one-file-system | 8 ++------
tests/du/restore-wd | 8 ++------
tests/du/slash | 8 ++------
tests/du/slink | 8 ++------
tests/du/trailing-slash | 8 ++------
tests/du/two-args | 8 ++------
tests/id/no-context | 8 ++------
tests/install/basic-1 | 8 ++------
tests/install/create-leading | 8 ++------
tests/install/d-slashdot | 8 ++------
tests/install/install-C | 8 ++------
tests/install/install-C-root | 8 ++------
tests/install/install-C-selinux | 8 ++------
tests/install/strip-program | 8 ++------
tests/install/trap | 8 ++------
tests/ln/backup-1 | 8 ++------
tests/ln/hard-backup | 8 ++------
tests/ln/hard-to-sym | 8 ++------
tests/ln/misc | 8 ++------
tests/ln/slash-decorated-nonexistent-dest | 8 ++------
tests/ln/target-1 | 8 ++------
tests/ls/abmon-align | 8 ++------
tests/ls/capability | 8 ++------
tests/ls/color-clear-to-eol | 8 ++------
tests/ls/color-dtype-dir | 8 ++------
tests/ls/color-norm | 8 ++------
tests/ls/dangle | 8 ++------
tests/ls/dired | 8 ++------
tests/ls/file-type | 8 ++------
tests/ls/follow-slink | 8 ++------
tests/ls/infloop | 8 ++------
tests/ls/inode | 8 ++------
tests/ls/m-option | 8 ++------
tests/ls/multihardlink | 8 ++------
tests/ls/no-arg | 8 ++------
tests/ls/no-cap | 8 ++------
tests/ls/proc-selinux-segfault | 8 ++------
tests/ls/readdir-mountpoint-inode | 8 ++------
tests/ls/recursive | 8 ++------
tests/ls/stat-dtype | 8 ++------
tests/ls/stat-failed | 8 ++------
tests/ls/stat-free-symlinks | 8 ++------
tests/ls/stat-vs-dirent | 8 ++------
tests/ls/symlink-slash | 8 ++------
tests/ls/x-option | 8 ++------
tests/misc/cat-buf | 8 ++------
tests/misc/cat-proc | 8 ++------
tests/misc/chcon | 8 ++------
tests/misc/chcon-fail | 8 ++------
tests/misc/chroot-credentials | 8 ++------
tests/misc/chroot-fail | 8 ++------
tests/misc/close-stdout | 8 ++------
tests/misc/csplit | 8 ++------
tests/misc/date-sec | 8 ++------
tests/misc/df | 8 ++------
tests/misc/df-P | 8 ++------
tests/misc/env | 8 ++------
tests/misc/false-status | 8 ++------
tests/misc/fmt-long-line | 8 ++------
tests/misc/groups-dash | 8 ++------
tests/misc/groups-version | 8 ++------
tests/misc/head-c | 8 ++------
tests/misc/head-pos | 8 ++------
tests/misc/id-context | 8 ++------
tests/misc/id-groups | 8 ++------
tests/misc/ls-time | 8 ++------
tests/misc/mknod | 8 ++------
tests/misc/nice | 8 ++------
tests/misc/nice-fail | 8 ++------
tests/misc/nl | 8 ++------
tests/misc/nohup | 8 ++------
tests/misc/nproc-avail | 8 ++------
tests/misc/nproc-positive | 8 ++------
tests/misc/od-N | 8 ++------
tests/misc/od-multiple-t | 8 ++------
tests/misc/od-x8 | 8 ++------
tests/misc/pathchk1 | 8 ++------
tests/misc/ptx-overrun | 8 ++------
tests/misc/readlink-fp-loop | 8 ++------
tests/misc/runcon-no-reorder | 8 ++------
tests/misc/seq-long-double | 8 ++------
tests/misc/shred-exact | 8 ++------
tests/misc/shred-passes | 8 ++------
tests/misc/shred-remove | 8 ++------
tests/misc/shuf | 8 ++------
tests/misc/sort-compress | 8 ++------
tests/misc/sort-continue | 8 ++------
tests/misc/sort-debug-keys | 8 ++------
tests/misc/sort-debug-warn | 8 ++------
tests/misc/sort-float | 8 ++------
tests/misc/sort-merge-fdlimit | 8 ++------
tests/misc/sort-month | 8 ++------
tests/misc/sort-rand | 8 ++------
tests/misc/sort-version | 8 ++------
tests/misc/split-a | 8 ++------
tests/misc/split-fail | 8 ++------
tests/misc/split-l | 8 ++------
tests/misc/stat-fmt | 8 ++------
tests/misc/stat-hyphen | 8 ++------
tests/misc/stat-slash | 8 ++------
tests/misc/stty-invalid | 8 ++------
tests/misc/tac-continue | 8 ++------
tests/misc/tee | 8 ++------
tests/misc/tee-dash | 8 ++------
tests/misc/timeout | 8 ++------
tests/misc/timeout-parameters | 8 ++------
tests/misc/truncate-dangling-symlink | 8 ++------
tests/misc/truncate-dir-fail | 8 ++------
tests/misc/truncate-fail-diag | 8 ++------
tests/misc/truncate-fifo | 8 ++------
tests/misc/truncate-no-create-missing | 8 ++------
tests/misc/truncate-overflow | 8 ++------
tests/misc/truncate-parameters | 8 ++------
tests/misc/truncate-relative | 8 ++------
tests/misc/wc-files0 | 8 ++------
tests/mkdir/p-1 | 8 ++------
tests/mkdir/p-2 | 8 ++------
tests/mkdir/p-3 | 8 ++------
tests/mkdir/p-slashdot | 8 ++------
tests/mkdir/p-thru-slink | 8 ++------
tests/mkdir/p-v | 8 ++------
tests/mkdir/parents | 8 ++------
tests/mkdir/perm | 8 ++------
tests/mkdir/special-1 | 8 ++------
tests/mkdir/t-slash | 8 ++------
tests/mkdir/writable-under-readonly | 8 ++------
tests/mv/atomic | 8 ++------
tests/mv/atomic2 | 8 ++------
tests/mv/backup-dir | 8 ++------
tests/mv/backup-is-src | 8 ++------
tests/mv/dir-file | 8 ++------
tests/mv/dir2dir | 8 ++------
tests/mv/force | 8 ++------
tests/mv/hard-3 | 8 ++------
tests/mv/hard-4 | 8 ++------
tests/mv/hard-link-1 | 8 ++------
tests/mv/hard-verbose | 8 ++------
tests/mv/i-3 | 8 ++------
tests/mv/i-4 | 8 ++------
tests/mv/i-5 | 8 ++------
tests/mv/i-link-no | 8 ++------
tests/mv/into-self | 8 ++------
tests/mv/into-self-2 | 8 ++------
tests/mv/into-self-3 | 8 ++------
tests/mv/into-self-4 | 8 ++------
tests/mv/leak-fd | 8 ++------
tests/mv/mv-n | 8 ++------
tests/mv/mv-special-1 | 8 ++------
tests/mv/no-target-dir | 8 ++------
tests/mv/part-fail | 8 ++------
tests/mv/part-hardlink | 8 ++------
tests/mv/part-rename | 8 ++------
tests/mv/partition-perm | 8 ++------
tests/mv/perm-1 | 8 ++------
tests/mv/sticky-to-xpart | 8 ++------
tests/mv/to-symlink | 8 ++------
tests/mv/trailing-slash | 8 ++------
tests/readlink/can-e | 8 ++------
tests/readlink/can-f | 8 ++------
tests/readlink/can-m | 8 ++------
tests/readlink/rl-1 | 8 ++------
tests/rm/cycle | 8 ++------
tests/rm/dangling-symlink | 8 ++------
tests/rm/deep-1 | 8 ++------
tests/rm/deep-2 | 8 ++------
tests/rm/dir-no-w | 8 ++------
tests/rm/dir-nonrecur | 8 ++------
tests/rm/dot-rel | 8 ++------
tests/rm/empty-inacc | 8 ++------
tests/rm/ext3-perf | 8 ++------
tests/rm/f-1 | 8 ++------
tests/rm/fail-2eperm | 8 ++------
tests/rm/fail-eacces | 8 ++------
tests/rm/hash | 8 ++------
tests/rm/i-1 | 8 ++------
tests/rm/i-never | 8 ++------
tests/rm/i-no-r | 8 ++------
tests/rm/ignorable | 8 ++------
tests/rm/inaccessible | 8 ++------
tests/rm/interactive-always | 8 ++------
tests/rm/interactive-once | 8 ++------
tests/rm/ir-1 | 8 ++------
tests/rm/isatty | 8 ++------
tests/rm/no-give-up | 8 ++------
tests/rm/one-file-system | 8 ++------
tests/rm/one-file-system2 | 8 ++------
tests/rm/r-1 | 8 ++------
tests/rm/r-2 | 8 ++------
tests/rm/r-3 | 8 ++------
tests/rm/r-4 | 8 ++------
tests/rm/read-only | 8 ++------
tests/rm/readdir-bug | 8 ++------
tests/rm/rm1 | 8 ++------
tests/rm/rm2 | 8 ++------
tests/rm/rm3 | 8 ++------
tests/rm/rm4 | 8 ++------
tests/rm/rm5 | 8 ++------
tests/rm/sunos-1 | 8 ++------
tests/rm/unread2 | 8 ++------
tests/rm/unread3 | 8 ++------
tests/rm/v-slash | 8 ++------
tests/rmdir/fail-perm | 8 ++------
tests/rmdir/ignore | 8 ++------
tests/rmdir/t-slash | 8 ++------
tests/tail-2/append-only | 8 ++------
tests/tail-2/assert | 8 ++------
tests/tail-2/assert-2 | 8 ++------
tests/tail-2/big-4gb | 8 ++------
tests/tail-2/flush-initial | 8 ++------
tests/tail-2/follow-stdin | 8 ++------
tests/tail-2/infloop-1 | 8 ++------
tests/tail-2/inotify-hash-abuse2 | 8 ++------
tests/tail-2/inotify-race | 8 ++------
tests/tail-2/pid | 8 ++------
tests/tail-2/pipe-f | 8 ++------
tests/tail-2/pipe-f2 | 8 ++------
tests/tail-2/proc-ksyms | 8 ++------
tests/tail-2/start-middle | 8 ++------
tests/tail-2/tail-n0f | 8 ++------
tests/tail-2/wait | 8 ++------
tests/touch/60-seconds | 8 ++------
tests/touch/dangling-symlink | 8 ++------
tests/touch/dir-1 | 8 ++------
tests/touch/empty-file | 8 ++------
tests/touch/fail-diag | 8 ++------
tests/touch/fifo | 8 ++------
tests/touch/no-create-missing | 8 ++------
tests/touch/no-dereference | 8 ++------
tests/touch/no-rights | 8 ++------
tests/touch/not-owner | 8 ++------
tests/touch/now-owned-by-other | 8 ++------
tests/touch/obsolescent | 8 ++------
tests/touch/read-only | 8 ++------
tests/touch/relative | 8 ++------
tests/touch/trailing-slash | 8 ++------
323 files changed, 646 insertions(+), 1938 deletions(-)
diff --git a/tests/chgrp/basic b/tests/chgrp/basic
index 19e9602..7d67166 100755
--- a/tests/chgrp/basic
+++ b/tests/chgrp/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_membership_in_two_groups_
[6000+ lines elided -- the elided changes were induced by the command above]
>From da4337829ef01e3aa38a4c0f4c2d52cf6ee504d8 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 14 Nov 2010 12:02:39 +0100
Subject: [PATCH 3/5] tests: convert 'if test "$VERBOSE" = yes; then' to test
... &&
---
tests/chmod/silent | 8 +-------
tests/cp/acl | 11 ++---------
tests/cp/cp-mv-backup | 8 +-------
tests/cp/cp-mv-enotsup-xattr | 8 ++------
tests/cp/perm | 8 ++------
tests/cp/preserve-gid | 7 ++-----
tests/ln/sf-1 | 7 +------
tests/ls/nameless-uid | 7 ++-----
tests/ls/rt-1 | 8 +-------
tests/misc/arch | 8 ++------
tests/misc/env-null | 9 +--------
tests/misc/md5sum-parallel | 7 +------
tests/misc/printenv | 7 +------
tests/misc/printf | 7 ++-----
tests/misc/printf-hex | 12 ++----------
tests/misc/printf-surprise | 7 ++-----
tests/misc/pwd-long | 2 ++
tests/misc/pwd-option | 6 +-----
tests/misc/pwd-unreadable-parent | 7 +------
tests/misc/selinux | 11 ++---------
tests/misc/stdbuf | 7 ++-----
tests/misc/stty | 7 ++-----
tests/misc/stty-row-col | 10 ++--------
tests/misc/su-fail | 8 ++------
tests/misc/sum-sysv | 7 +------
tests/misc/truncate-owned-by-other | 8 ++------
tests/misc/wc-parallel | 7 +------
tests/misc/xattr | 8 +-------
tests/mkdir/selinux | 8 +-------
tests/mv/acl | 9 ++-------
tests/mv/childproof | 9 ++-------
tests/mv/diag | 7 +------
tests/mv/dup-source | 9 ++-------
tests/mv/hard-2 | 8 ++------
tests/mv/i-2 | 11 ++---------
tests/mv/part-symlink | 8 ++------
tests/mv/update | 7 +------
tests/rm/one-file-system | 1 -
38 files changed, 59 insertions(+), 235 deletions(-)
diff --git a/tests/chmod/silent b/tests/chmod/silent
index 9f9f86f..2cfbcbb 100755
--- a/tests/chmod/silent
+++ b/tests/chmod/silent
@@ -16,14 +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
- chmod --version
- chown --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { chgrp --version; chmod --version; chown --version; }
chmod -f 0 no-such 2> out && fail=1
chgrp -f 0 no-such 2>> out && fail=1
diff --git a/tests/cp/acl b/tests/cp/acl
index c19eb4e..3e93645 100755
--- a/tests/cp/acl
+++ b/tests/cp/acl
@@ -17,16 +17,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Make sure we get English translations.
-
-if test "$VERBOSE" = yes; then
- set -x
- mv --version
- getfacl --version
- setfacl --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { mv --version; getfacl --version; setfacl --version;
}
+
require_acl_
# Skip this test if cp was built without ACL support:
diff --git a/tests/cp/cp-mv-backup b/tests/cp/cp-mv-backup
index 515c0c5..c978ba2 100755
--- a/tests/cp/cp-mv-backup
+++ b/tests/cp/cp-mv-backup
@@ -16,14 +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
- cp --version
-fi
-
-# Ensure that ls sorts the same way for everyone.
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && cp --version
umask 022
diff --git a/tests/cp/cp-mv-enotsup-xattr b/tests/cp/cp-mv-enotsup-xattr
index 7e7b645..bd0ef0e 100755
--- a/tests/cp/cp-mv-enotsup-xattr
+++ b/tests/cp/cp-mv-enotsup-xattr
@@ -18,13 +18,9 @@
# 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
- cp --version
- mv --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { cp --version; mv --version; }
+
require_root_
cwd=`pwd`
diff --git a/tests/cp/perm b/tests/cp/perm
index f68e529..346b245 100755
--- a/tests/cp/perm
+++ b/tests/cp/perm
@@ -16,13 +16,9 @@
# 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
- cp --version
- mv --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { cp --version; mv --version; }
+
very_expensive_
umask 037
diff --git a/tests/cp/preserve-gid b/tests/cp/preserve-gid
index f9a9d2a..a5190e4 100755
--- a/tests/cp/preserve-gid
+++ b/tests/cp/preserve-gid
@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && cp --version
+
require_root_
# Some of the tests expect a umask that grants group and/or world read access.
@@ -58,11 +60,6 @@ t1() {
"$nameless_uid" "$@"
}
-if test "x$VERBOSE" = xyes; then
- set -x
- cp --version
-fi
-
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 }'`
diff --git a/tests/ln/sf-1 b/tests/ln/sf-1
index 518990c..fdfc3f7 100755
--- a/tests/ln/sf-1
+++ b/tests/ln/sf-1
@@ -16,13 +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
- ln --version
-fi
-
-# Make sure we get English translations.
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && ln --version
echo foo > a || framework_failure
ln -s . b || framework_failure
diff --git a/tests/ls/nameless-uid b/tests/ls/nameless-uid
index 55e8d16..bf2dfcd 100755
--- a/tests/ls/nameless-uid
+++ b/tests/ls/nameless-uid
@@ -16,15 +16,12 @@
# 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
- ls --version
-fi
-
: ${srcdir=.}
. $srcdir/require-perl
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && ls --version
+
require_root_
nameless_uid=`$PERL -e 'foreach my $i (1000..16*1024) { getpwuid $i or (print
"$i\n"), exit }'`
diff --git a/tests/ls/rt-1 b/tests/ls/rt-1
index da632bb..51d0236 100755
--- a/tests/ls/rt-1
+++ b/tests/ls/rt-1
@@ -16,14 +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
- ls --version
- touch --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { ls --version; touch --version; }
date=1998-01-15
diff --git a/tests/misc/arch b/tests/misc/arch
index b7164e4..a4475e6 100755
--- a/tests/misc/arch
+++ b/tests/misc/arch
@@ -17,13 +17,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-lib.sh
-require_built_ arch
-
-if test "$VERBOSE" = yes; then
- set -x
- arch --version
-fi
+test "$VERBOSE" = yes && arch --version
+require_built_ arch
arch > out || fail=1
uname -m > exp || fail=1
diff --git a/tests/misc/env-null b/tests/misc/env-null
index 53d1b62..ed2e21d 100755
--- a/tests/misc/env-null
+++ b/tests/misc/env-null
@@ -16,15 +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
- env --version
- env -- printenv --version
-fi
-
. $srcdir/test-lib.sh
-
+test "$VERBOSE" = yes && { env --version; env -- printenv --version; }
# POSIX is clear that environ may, but need not be, sorted.
# Environment variable values may contain newlines, which cannot be
diff --git a/tests/misc/md5sum-parallel b/tests/misc/md5sum-parallel
index 0243e85..6f38b8b 100755
--- a/tests/misc/md5sum-parallel
+++ b/tests/misc/md5sum-parallel
@@ -18,12 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-lib.sh
-
-if test "$VERBOSE" = yes; then
- set -x
- md5sum --version
-fi
-
+test "$VERBOSE" = yes && md5sum --version
(mkdir tmp && cd tmp && seq 500 | xargs touch)
diff --git a/tests/misc/printenv b/tests/misc/printenv
index f0e2cd2..dd82c05 100755
--- a/tests/misc/printenv
+++ b/tests/misc/printenv
@@ -16,13 +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
- env -- printenv --version
-fi
-
. $srcdir/test-lib.sh
-
+test "$VERBOSE" = yes && env -- printenv --version
# Without arguments, printenv behaves like env. Some shells provide
# printenv as a builtin, so we must invoke it via "env".
diff --git a/tests/misc/printf b/tests/misc/printf
index e8e4f2e..cf376f3 100755
--- a/tests/misc/printf
+++ b/tests/misc/printf
@@ -18,12 +18,9 @@
prog="$abs_top_builddir/src/printf"
-if test "$VERBOSE" = yes; then
- set -x
- "$prog" --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && env -- printf --version
+
getlimits_
diff --git a/tests/misc/printf-hex b/tests/misc/printf-hex
index e428d26..39b70d6 100755
--- a/tests/misc/printf-hex
+++ b/tests/misc/printf-hex
@@ -16,18 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-prog="$abs_top_builddir/src/printf"
-
-if test "$VERBOSE" = yes; then
- set -x
- "$prog" --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && env -- printf --version
-
-
-"$prog" '\x7e3\n' > out || fail=1
+env printf '\x7e3\n' > out || fail=1
cat <<\EOF > exp
~3
EOF
diff --git a/tests/misc/printf-surprise b/tests/misc/printf-surprise
index 581a6d4..702ab67 100755
--- a/tests/misc/printf-surprise
+++ b/tests/misc/printf-surprise
@@ -18,12 +18,9 @@
prog=printf
-if test "$VERBOSE" = yes; then
- set -x
- env $prog --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && env -- printf --version
+
require_ulimit_
diff --git a/tests/misc/pwd-long b/tests/misc/pwd-long
index 5702552..c58207a 100755
--- a/tests/misc/pwd-long
+++ b/tests/misc/pwd-long
@@ -21,6 +21,8 @@
. $srcdir/require-perl
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && env -- pwd --version
+
require_readable_root_
ARGV_0=$0
diff --git a/tests/misc/pwd-option b/tests/misc/pwd-option
index c1a28fe..e4ecf11 100755
--- a/tests/misc/pwd-option
+++ b/tests/misc/pwd-option
@@ -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
- env -- pwd --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && env -- pwd --version
mkdir -p a/b || framework_failure
ln -s a/b c || framework_failure
diff --git a/tests/misc/pwd-unreadable-parent b/tests/misc/pwd-unreadable-parent
index dc6dde4..1f3d914 100755
--- a/tests/misc/pwd-unreadable-parent
+++ b/tests/misc/pwd-unreadable-parent
@@ -18,13 +18,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
- env -- pwd --version
- readlink --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { env -- pwd --version; readlink --version; }
test $host_os != linux-gnu &&
skip_test_ 'vendor getcwd may be inadequate'
diff --git a/tests/misc/selinux b/tests/misc/selinux
index 3729024..0a8259f 100755
--- a/tests/misc/selinux
+++ b/tests/misc/selinux
@@ -16,16 +16,9 @@
# 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
- chcon --version
- cp --version
- ls --version
- mv --version
- stat --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && for i in chcon cp ls mv stat; do $i --version; done
+
require_root_
require_selinux_
skip_if_mcstransd_is_running_
diff --git a/tests/misc/stdbuf b/tests/misc/stdbuf
index 5822698..8302c48 100755
--- a/tests/misc/stdbuf
+++ b/tests/misc/stdbuf
@@ -17,14 +17,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { stdbuf --version; mv --version; }
+
getlimits_
require_built_ stdbuf
-if test "$VERBOSE" = yes; then
- set -x
- stdbuf --version
-fi
-
# stdbuf fails when the absolute top build dir name contains e.g., space, TAB,
NL
lf='
'
diff --git a/tests/misc/stty b/tests/misc/stty
index 28dd90e..0659d51 100755
--- a/tests/misc/stty
+++ b/tests/misc/stty
@@ -16,13 +16,10 @@
# 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
- stty --version
-fi
-
# Make sure there's a tty on stdin.
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && stty --version
+
require_controlling_input_terminal_
trap '' TTOU # Ignore SIGTTOU
diff --git a/tests/misc/stty-row-col b/tests/misc/stty-row-col
index bb1153a..5acb3d0 100755
--- a/tests/misc/stty-row-col
+++ b/tests/misc/stty-row-col
@@ -16,14 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# This script takes no arguments.
-
-if test "$VERBOSE" = yes; then
- set -x
- stty --version
-fi
-
# Setting this envvar to a very small value used to cause e.g., `stty size'
# to generate slightly different output on certain systems.
COLUMNS=80
@@ -37,6 +29,8 @@ LC_ALL=C
export LC_ALL
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && stty --version
+
require_controlling_input_terminal_
trap '' TTOU # Ignore SIGTTOU
diff --git a/tests/misc/su-fail b/tests/misc/su-fail
index c230f17..4c57c94 100755
--- a/tests/misc/su-fail
+++ b/tests/misc/su-fail
@@ -17,13 +17,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-lib.sh
-require_built_ su
-
-if test "$VERBOSE" = yes; then
- set -x
- su --version
-fi
+test "$VERBOSE" = yes && su --version
+require_built_ su
# Very little that we can test without a root password
su --- / true # unknown option
diff --git a/tests/misc/sum-sysv b/tests/misc/sum-sysv
index 3de2784..705de27 100755
--- a/tests/misc/sum-sysv
+++ b/tests/misc/sum-sysv
@@ -16,11 +16,6 @@
# 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
- sum --version
-fi
-
: ${srcdir=.}
. $srcdir/require-perl
@@ -31,7 +26,7 @@ LC_ALL=C
export LC_ALL
. $srcdir/test-lib.sh
-
+test "$VERBOSE" = yes && sum --version
# FYI, 16843009 is floor (2^32 / 255).
diff --git a/tests/misc/truncate-owned-by-other
b/tests/misc/truncate-owned-by-other
index 3a8bde0..86fd528 100755
--- a/tests/misc/truncate-owned-by-other
+++ b/tests/misc/truncate-owned-by-other
@@ -16,13 +16,9 @@
# 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
- truncate --version
-fi
-
-. $srcdir/envvar-check
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && truncate --version
+
require_root_
group_num=$(id -g $NON_ROOT_USERNAME)
diff --git a/tests/misc/wc-parallel b/tests/misc/wc-parallel
index 8afdb2a..47f1044 100755
--- a/tests/misc/wc-parallel
+++ b/tests/misc/wc-parallel
@@ -18,12 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-lib.sh
-
-if test "$VERBOSE" = yes; then
- set -x
- md5sum --version
-fi
-
+test "$VERBOSE" = yes && md5sum --version
(mkdir tmp && cd tmp && seq 2000 | xargs touch)
diff --git a/tests/misc/xattr b/tests/misc/xattr
index 21e0f1c..3a27f15 100755
--- a/tests/misc/xattr
+++ b/tests/misc/xattr
@@ -18,14 +18,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
- cp --version
- mv --version
- ginstall --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { cp --version; mv --version; ginstall --version; }
# Skip this test if cp was built without xattr support:
touch src dest || framework_failure
diff --git a/tests/mkdir/selinux b/tests/mkdir/selinux
index 674b0b3..b0240eb 100755
--- a/tests/mkdir/selinux
+++ b/tests/mkdir/selinux
@@ -16,14 +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
- mkdir --version
- mkfifo --version
- mknod --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { mkdir --version; mkfifo --version; mknod --version;
}
# Note: on an SELinux/enforcing system running mcstransd older than
# mcstrans-0.2.8-1.fc9, the following commands may mistakenly exit
diff --git a/tests/mv/acl b/tests/mv/acl
index 16d7692..c67630e 100755
--- a/tests/mv/acl
+++ b/tests/mv/acl
@@ -17,14 +17,9 @@
# 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
- mv --version
- getfacl --version
- setfacl --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { mv --version; getfacl --version; setfacl --version;
}
+
require_acl_
# Skip this test if cp was built without ACL support:
diff --git a/tests/mv/childproof b/tests/mv/childproof
index 057ce91..2e5e461 100755
--- a/tests/mv/childproof
+++ b/tests/mv/childproof
@@ -18,14 +18,9 @@
# 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
- cp --version
- mv --version
- ln --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { cp --version; mv --version; ln --version; }
+
skip_if_root_
mkdir a b c || framework_failure
diff --git a/tests/mv/diag b/tests/mv/diag
index 1a23b53..f40fc7c 100755
--- a/tests/mv/diag
+++ b/tests/mv/diag
@@ -16,13 +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
- mv --version
-fi
-
-# Make sure we get English translations.
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && mv --version
touch f1 || framework_failure
touch f2 || framework_failure
diff --git a/tests/mv/dup-source b/tests/mv/dup-source
index ad947b4..9ede87e 100755
--- a/tests/mv/dup-source
+++ b/tests/mv/dup-source
@@ -19,15 +19,10 @@
# 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
- cp --version
- mv --version
-fi
-
. $srcdir/test-lib.sh
-skip_if_root_
+test "$VERBOSE" = yes && { cp --version; mv --version; }
+skip_if_root_
for i in cp; do
diff --git a/tests/mv/hard-2 b/tests/mv/hard-2
index 1ae0a34..704e267 100755
--- a/tests/mv/hard-2
+++ b/tests/mv/hard-2
@@ -17,13 +17,9 @@
# 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
- mv --version
- cp --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { cp --version; mv --version; }
+
skip_if_root_
mkdir dst || framework_failure
diff --git a/tests/mv/i-2 b/tests/mv/i-2
index aed1c9e..8359642 100755
--- a/tests/mv/i-2
+++ b/tests/mv/i-2
@@ -17,16 +17,9 @@
# 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
- mv --version
- cp --version
-fi
-
-
-# Make sure we get English translations.
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { cp --version; mv --version; }
+
skip_if_root_
for i in a b c d e f g h; do
diff --git a/tests/mv/part-symlink b/tests/mv/part-symlink
index 3b8e442..bf2fd45 100755
--- a/tests/mv/part-symlink
+++ b/tests/mv/part-symlink
@@ -17,13 +17,9 @@
# 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
- mv --version
- cp --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { cp --version; mv --version; }
+
cleanup_() { rm -rf "$other_partition_tmpdir"; }
. "$abs_srcdir/other-fs-tmpdir"
diff --git a/tests/mv/update b/tests/mv/update
index a803592..b0a532c 100755
--- a/tests/mv/update
+++ b/tests/mv/update
@@ -16,13 +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
- cp --version
- mv --version
-fi
-
. $srcdir/test-lib.sh
+test "$VERBOSE" = yes && { cp --version; mv --version; }
echo old > old || framework_failure
touch -d yesterday old || framework_failure
diff --git a/tests/rm/one-file-system b/tests/rm/one-file-system
index 8abf7dc..371607b 100755
--- a/tests/rm/one-file-system
+++ b/tests/rm/one-file-system
@@ -20,7 +20,6 @@
test "$VERBOSE" = yes && rm --version
require_root_
-# If used, these must *follow* test-lib.sh.
cleanup_()
{
# When you take the undesirable shortcut of making /etc/mtab a link
--
1.7.3.2.4.g60aa9
>From ff9990b0798a9a89056dc3592399f4fff20ca7cf Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 14 Nov 2010 12:07:57 +0100
Subject: [PATCH 4/5] tests: convert remaining uses of test-lib.sh to init.sh
RHS='. "\${srcdir=.}/init.sh"; path_prepend_ ../src'
git grep -l test-lib.sh \
| xargs perl -pi -e 's,^\. \$srcdir/test-lib\.sh$,'"$RHS",
---
tests/chmod/silent | 2 +-
tests/cp/acl | 2 +-
tests/cp/cp-mv-backup | 2 +-
tests/cp/cp-mv-enotsup-xattr | 2 +-
tests/cp/perm | 2 +-
tests/cp/preserve-gid | 2 +-
tests/ln/sf-1 | 2 +-
tests/ls/nameless-uid | 2 +-
tests/ls/rt-1 | 2 +-
tests/misc/arch | 2 +-
tests/misc/env-null | 2 +-
tests/misc/md5sum-parallel | 2 +-
tests/misc/printenv | 2 +-
tests/misc/printf | 2 +-
tests/misc/printf-hex | 2 +-
tests/misc/printf-surprise | 2 +-
tests/misc/pwd-long | 2 +-
tests/misc/pwd-option | 2 +-
tests/misc/pwd-unreadable-parent | 2 +-
tests/misc/selinux | 2 +-
tests/misc/stdbuf | 2 +-
tests/misc/stty | 2 +-
tests/misc/stty-row-col | 2 +-
tests/misc/su-fail | 2 +-
tests/misc/sum-sysv | 2 +-
tests/misc/truncate-owned-by-other | 2 +-
tests/misc/wc-parallel | 2 +-
tests/misc/xattr | 2 +-
tests/mkdir/selinux | 2 +-
tests/mv/acl | 2 +-
tests/mv/childproof | 2 +-
tests/mv/diag | 2 +-
tests/mv/dup-source | 2 +-
tests/mv/hard-2 | 2 +-
tests/mv/i-2 | 2 +-
tests/mv/part-symlink | 2 +-
tests/mv/update | 2 +-
37 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/tests/chmod/silent b/tests/chmod/silent
index 2cfbcbb..20c232b 100755
--- a/tests/chmod/silent
+++ b/tests/chmod/silent
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
test "$VERBOSE" = yes && { chgrp --version; chmod --version; chown --version; }
chmod -f 0 no-such 2> out && fail=1
[400+ lines elided -- those changes were induced by the command above]
>From 680e70b9afb8e114cae8bcd06e526be875ac8637 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 14 Nov 2010 12:13:58 +0100
Subject: [PATCH 5/5] tests: remove test-lib.sh; now all tests use gnulib's
init.sh
* tests/test-lib.sh: Remove file. No longer used.
* tests/Makefile.am (EXTRA_DIST): Remove it here, too.
* tests/sample-test: Correct a comment.
---
tests/Makefile.am | 1 -
tests/sample-test | 2 +-
tests/test-lib.sh | 81 -----------------------------------------------------
3 files changed, 1 insertions(+), 83 deletions(-)
delete mode 100644 tests/test-lib.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 90ff292..3bd7ad1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -16,7 +16,6 @@ EXTRA_DIST = \
other-fs-tmpdir \
require-perl \
sample-test \
- test-lib.sh \
$(pr_data)
root_tests = \
diff --git a/tests/sample-test b/tests/sample-test
index 51408ce..27dc3b2 100644
--- a/tests/sample-test
+++ b/tests/sample-test
@@ -22,7 +22,7 @@ test "$VERBOSE" = yes && FIXME --version
# FIXME: skip_if_root_
# FIXME: require_root_
-# If used, these must *follow* test-lib.sh.
+# If used, these must *follow* init.sh.
# FIXME: cleanup_() { rm -rf "$other_partition_tmpdir"; }
# FIXME: . "$abs_srcdir/other-fs-tmpdir"
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
deleted file mode 100644
index 82d6535..0000000
--- a/tests/test-lib.sh
+++ /dev/null
@@ -1,81 +0,0 @@
-# source this file; set up for tests
-
-# Copyright (C) 2009-2010 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
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Skip this test if the shell lacks support for functions.
-unset function_test
-eval 'function_test() { return 11; }; function_test'
-if test $? != 11; then
- echo "$0: /bin/sh lacks support for functions; skipping this test." 1>&2
- Exit 77
-fi
-
-# We use a trap below for cleanup. This requires us to go through
-# hoops to get the right exit status transported through the signal.
-# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
-# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
-# sh inside this function.
-Exit ()
-{
- set +e
- (exit $1)
- exit $1
-}
-
-test -f "$srcdir/init.cfg" \
- && . "$srcdir/init.cfg"
-
-test_dir_=$(pwd)
-
-this_test_() { echo "./$0" | sed 's,.*/,,'; }
-this_test=$(this_test_)
-
-# This is a stub function that is run upon trap (upon regular exit and
-# interrupt). Override it with a per-test function, e.g., to unmount
-# a partition, or to undo any other global state changes.
-cleanup_() { :; }
-
-t_=$("$abs_top_builddir/src/mktemp" -d --tmp="$test_dir_"
cu-$this_test.XXXXXXXXXX)\
- || error_ "failed to create temporary directory in $test_dir_"
-
-remove_tmp_()
-{
- __st=$?
- cleanup_
- cd "$test_dir_" && chmod -R u+rwx "$t_" && rm -rf "$t_" && exit $__st
-}
-
-# Run each test from within a temporary sub-directory named after the
-# test itself, and arrange to remove it upon exception or normal exit.
-trap remove_tmp_ 0
-trap 'Exit 129' 1
-trap 'Exit 130' 2
-trap 'Exit 131' 3
-trap 'Exit 141' 13
-trap 'Exit 143' 15
-
-cd "$t_" || error_ "failed to cd to $t_"
-
-if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
- compare() { diff -u "$@"; }
-elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
- compare() { cmp -s "$@"; }
-else
- compare() { cmp "$@"; }
-fi
-
-# Initialize; all bourne shell scripts end with "Exit $fail".
-fail=0
--
1.7.3.2.4.g60aa9
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#7400: tests: get rid of test-lib.sh: use gnulib's init.sh instead,
Jim Meyering <=