diff options
author | Jim Meyering <meyering@redhat.com> | 2010-11-14 11:05:05 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-11-17 20:48:57 +0100 |
commit | f38becab02472e6872048a1951b249b2a3c054df (patch) | |
tree | e5b531384b55abae8b1829ada892891bfee58fe3 /tests/tail-2 | |
parent | 30b74dfff16240ea0e4a4c5b705f1e9631e5d0a7 (diff) | |
download | coreutils-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/tail-2')
-rwxr-xr-x | tests/tail-2/append-only | 8 | ||||
-rwxr-xr-x | tests/tail-2/assert | 8 | ||||
-rwxr-xr-x | tests/tail-2/assert-2 | 8 | ||||
-rwxr-xr-x | tests/tail-2/big-4gb | 8 | ||||
-rwxr-xr-x | tests/tail-2/flush-initial | 8 | ||||
-rwxr-xr-x | tests/tail-2/follow-stdin | 8 | ||||
-rwxr-xr-x | tests/tail-2/infloop-1 | 8 | ||||
-rwxr-xr-x | tests/tail-2/inotify-hash-abuse2 | 8 | ||||
-rwxr-xr-x | tests/tail-2/inotify-race | 8 | ||||
-rwxr-xr-x | tests/tail-2/pid | 8 | ||||
-rwxr-xr-x | tests/tail-2/pipe-f | 8 | ||||
-rwxr-xr-x | tests/tail-2/pipe-f2 | 8 | ||||
-rwxr-xr-x | tests/tail-2/proc-ksyms | 8 | ||||
-rwxr-xr-x | tests/tail-2/start-middle | 8 | ||||
-rwxr-xr-x | tests/tail-2/tail-n0f | 8 | ||||
-rwxr-xr-x | tests/tail-2/wait | 8 |
16 files changed, 32 insertions, 96 deletions
diff --git a/tests/tail-2/append-only b/tests/tail-2/append-only index 327c41c6f..32578fe57 100755 --- a/tests/tail-2/append-only +++ b/tests/tail-2/append-only @@ -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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version require_root_ chattr_a_works=1 diff --git a/tests/tail-2/assert b/tests/tail-2/assert index 08cd88864..1fdb76a77 100755 --- a/tests/tail-2/assert +++ b/tests/tail-2/assert @@ -23,12 +23,8 @@ # Aborted # due to a race condition in which a dev/inode pair is reused. -if test "$VERBOSE" = yes; then - set -x - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version # Not "expensive" per se, but sleeping for so long is annoying. very_expensive_ diff --git a/tests/tail-2/assert-2 b/tests/tail-2/assert-2 index 066d6af2c..fec0525ed 100755 --- a/tests/tail-2/assert-2 +++ b/tests/tail-2/assert-2 @@ -18,12 +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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version # Not "expensive" per se, but sleeping for so long is annoying. very_expensive_ diff --git a/tests/tail-2/big-4gb b/tests/tail-2/big-4gb index ec262a946..3496a622f 100755 --- a/tests/tail-2/big-4gb +++ b/tests/tail-2/big-4gb @@ -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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version expensive_ # Create a file of size exactly 4GB (2^32) with 8 bytes diff --git a/tests/tail-2/flush-initial b/tests/tail-2/flush-initial index 98de2e1f5..df8810dcc 100755 --- a/tests/tail-2/flush-initial +++ b/tests/tail-2/flush-initial @@ -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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version echo line > in || fail=1 # Output should be buffered since we're writing to file diff --git a/tests/tail-2/follow-stdin b/tests/tail-2/follow-stdin index a0e07e6bc..1c50e8b66 100755 --- a/tests/tail-2/follow-stdin +++ b/tests/tail-2/follow-stdin @@ -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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version echo line > exp || framework_failure echo line > in || framework_failure diff --git a/tests/tail-2/infloop-1 b/tests/tail-2/infloop-1 index 895b21dca..7e98daf6a 100755 --- a/tests/tail-2/infloop-1 +++ b/tests/tail-2/infloop-1 @@ -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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version yes > t & yes_pid=$! diff --git a/tests/tail-2/inotify-hash-abuse2 b/tests/tail-2/inotify-hash-abuse2 index c0cca2338..f3018a57a 100755 --- a/tests/tail-2/inotify-hash-abuse2 +++ b/tests/tail-2/inotify-hash-abuse2 @@ -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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version touch f || framework_failure diff --git a/tests/tail-2/inotify-race b/tests/tail-2/inotify-race index a6393df56..2deff69ae 100755 --- a/tests/tail-2/inotify-race +++ b/tests/tail-2/inotify-race @@ -20,12 +20,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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version # Don't run this test by default because sometimes it's skipped as noted below. # Also gdb has a bug in Debian's gdb-6.8-3 at least that causes it to not diff --git a/tests/tail-2/pid b/tests/tail-2/pid index b1286df05..b684a3617 100755 --- a/tests/tail-2/pid +++ b/tests/tail-2/pid @@ -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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version getlimits_ touch empty here || framework_failure diff --git a/tests/tail-2/pipe-f b/tests/tail-2/pipe-f index bf38c183c..b6fef16d7 100755 --- a/tests/tail-2/pipe-f +++ b/tests/tail-2/pipe-f @@ -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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version echo foo | timeout 10 tail -f -c3 > out || fail=1 echo oo > exp || fail=1 diff --git a/tests/tail-2/pipe-f2 b/tests/tail-2/pipe-f2 index 83a226520..426f37b50 100755 --- a/tests/tail-2/pipe-f2 +++ b/tests/tail-2/pipe-f2 @@ -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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version mkfifo_or_skip_ fifo diff --git a/tests/tail-2/proc-ksyms b/tests/tail-2/proc-ksyms index 21e275291..3e63bfed8 100755 --- a/tests/tail-2/proc-ksyms +++ b/tests/tail-2/proc-ksyms @@ -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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version ksyms=/proc/ksyms diff --git a/tests/tail-2/start-middle b/tests/tail-2/start-middle index b98c86863..404562d88 100755 --- a/tests/tail-2/start-middle +++ b/tests/tail-2/start-middle @@ -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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version (echo 1; echo 2) > k || framework_failure diff --git a/tests/tail-2/tail-n0f b/tests/tail-2/tail-n0f index 6a9b59c37..d7badd74f 100755 --- a/tests/tail-2/tail-n0f +++ b/tests/tail-2/tail-n0f @@ -21,12 +21,8 @@ # It skips the test if your system lacks a /proc/$pid/status # file, or if its contents don't look right. -if test "$VERBOSE" = yes; then - set -x - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version require_proc_pid_status_ diff --git a/tests/tail-2/wait b/tests/tail-2/wait index a9636910e..36cfa0e8c 100755 --- a/tests/tail-2/wait +++ b/tests/tail-2/wait @@ -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 - tail --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tail --version touch here || framework_failure { touch unreadable && chmod a-r unreadable; } || framework_failure |