From f38becab02472e6872048a1951b249b2a3c054df Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 14 Nov 2010 11:05:05 +0100 Subject: 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/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 ++------ 70 files changed, 140 insertions(+), 420 deletions(-) (limited to 'tests/misc') diff --git a/tests/misc/cat-buf b/tests/misc/cat-buf index cd6f9df8a..303c4e268 100755 --- a/tests/misc/cat-buf +++ b/tests/misc/cat-buf @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - cat --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && cat --version # Use a fifo rather than a pipe in the tests below # so that the producer (cat) will wait until the diff --git a/tests/misc/cat-proc b/tests/misc/cat-proc index 9219d86aa..7214c25c8 100755 --- a/tests/misc/cat-proc +++ b/tests/misc/cat-proc @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - cat --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && cat --version f=/proc/cpuinfo diff --git a/tests/misc/chcon b/tests/misc/chcon index 72961b077..3aefab51b 100755 --- a/tests/misc/chcon +++ b/tests/misc/chcon @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - chcon --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chcon --version require_root_ require_selinux_ skip_if_mcstransd_is_running_ diff --git a/tests/misc/chcon-fail b/tests/misc/chcon-fail index e099256d0..4daa848cf 100755 --- a/tests/misc/chcon-fail +++ b/tests/misc/chcon-fail @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - chcon --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chcon --version # neither context nor file diff --git a/tests/misc/chroot-credentials b/tests/misc/chroot-credentials index bf79c05ce..e671f7fc8 100755 --- a/tests/misc/chroot-credentials +++ b/tests/misc/chroot-credentials @@ -17,12 +17,8 @@ # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - chroot --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chroot --version require_root_ diff --git a/tests/misc/chroot-fail b/tests/misc/chroot-fail index 6b4e2d8e1..a3044f70b 100755 --- a/tests/misc/chroot-fail +++ b/tests/misc/chroot-fail @@ -17,12 +17,8 @@ # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - chroot --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chroot --version # These tests verify exact status of internal failure; since none of diff --git a/tests/misc/close-stdout b/tests/misc/close-stdout index c7b0b65a9..e236558db 100755 --- a/tests/misc/close-stdout +++ b/tests/misc/close-stdout @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - rm --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && rm --version p=$abs_top_builddir diff --git a/tests/misc/csplit b/tests/misc/csplit index f365da335..98c704c14 100755 --- a/tests/misc/csplit +++ b/tests/misc/csplit @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - csplit --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && csplit --version # csplit could get a failed assertion to 2.0.17 diff --git a/tests/misc/date-sec b/tests/misc/date-sec index 0d184131c..a9f19a55b 100755 --- a/tests/misc/date-sec +++ b/tests/misc/date-sec @@ -18,12 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - date --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && date --version diff --git a/tests/misc/df b/tests/misc/df index 730f841a3..22451c53a 100755 --- a/tests/misc/df +++ b/tests/misc/df @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - df --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && df --version case `df .` in *' diff --git a/tests/misc/df-P b/tests/misc/df-P index c7cada499..bd4e0bc7c 100755 --- a/tests/misc/df-P +++ b/tests/misc/df-P @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - df --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && df --version df -P . > t1 || fail=1 diff --git a/tests/misc/env b/tests/misc/env index 96a4eaba6..11343a1ff 100755 --- a/tests/misc/env +++ b/tests/misc/env @@ -17,12 +17,8 @@ # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - env --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && env --version # Verify clearing the environment diff --git a/tests/misc/false-status b/tests/misc/false-status index 28f4ce4f2..a8e1fa624 100755 --- a/tests/misc/false-status +++ b/tests/misc/false-status @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - false --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && false --version false --version > /dev/null && fail=1 false --help > /dev/null && fail=1 diff --git a/tests/misc/fmt-long-line b/tests/misc/fmt-long-line index a8be381f1..3fb98e572 100755 --- a/tests/misc/fmt-long-line +++ b/tests/misc/fmt-long-line @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - fmt --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && fmt --version printf '%2030s\n' ' '|sed 's/../ y/g' > in || framework_failure diff --git a/tests/misc/groups-dash b/tests/misc/groups-dash index 5c7989e1d..ea4b94ac7 100755 --- a/tests/misc/groups-dash +++ b/tests/misc/groups-dash @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - groups --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && groups --version require_built_ groups # Coreutils 6.9 and earlier failed to display information on first argument diff --git a/tests/misc/groups-version b/tests/misc/groups-version index b3a87873b..ec157a26c 100755 --- a/tests/misc/groups-version +++ b/tests/misc/groups-version @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - groups --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && groups --version require_built_ groups groups --version | sed 's/^groups/id/; /^$/q' > out || fail=1 diff --git a/tests/misc/head-c b/tests/misc/head-c index ab933ec7b..70a0b45e8 100755 --- a/tests/misc/head-c +++ b/tests/misc/head-c @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - head --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && head --version echo abc > in || framework_failure diff --git a/tests/misc/head-pos b/tests/misc/head-pos index abbf22c0a..8d5d00a27 100755 --- a/tests/misc/head-pos +++ b/tests/misc/head-pos @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - head --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && head --version (echo a; echo b) > in || framework_failure diff --git a/tests/misc/id-context b/tests/misc/id-context index b49fbc692..8e380944c 100755 --- a/tests/misc/id-context +++ b/tests/misc/id-context @@ -15,12 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - id --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && id --version # Require selinux - when selinux is disabled, id never prints scontext. require_selinux_ diff --git a/tests/misc/id-groups b/tests/misc/id-groups index 0b50930c8..8a6eea34d 100755 --- a/tests/misc/id-groups +++ b/tests/misc/id-groups @@ -15,12 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - id --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && id --version id -G $(id -nu) || fail=1 diff --git a/tests/misc/ls-time b/tests/misc/ls-time index eda0f0105..721fb8128 100755 --- a/tests/misc/ls-time +++ b/tests/misc/ls-time @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - ls --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ls --version # Avoid any possible glitches due to daylight-saving changes near the # time stamps used during the test. diff --git a/tests/misc/mknod b/tests/misc/mknod index 872249262..049ed0f72 100755 --- a/tests/misc/mknod +++ b/tests/misc/mknod @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - mknod --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mknod --version umask 777 diff --git a/tests/misc/nice b/tests/misc/nice index 3a724ad83..939a9aa62 100755 --- a/tests/misc/nice +++ b/tests/misc/nice @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - nice --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && nice --version tests=' 0 empty 10 diff --git a/tests/misc/nice-fail b/tests/misc/nice-fail index 944023387..6c8314c6b 100755 --- a/tests/misc/nice-fail +++ b/tests/misc/nice-fail @@ -17,12 +17,8 @@ # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - nice --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && nice --version # These tests verify exact status of internal failure. diff --git a/tests/misc/nl b/tests/misc/nl index 506501d91..81d0a40de 100755 --- a/tests/misc/nl +++ b/tests/misc/nl @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - nl --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && nl --version echo a | nl > out || fail=1 diff --git a/tests/misc/nohup b/tests/misc/nohup index a7246df16..9d3d76aa6 100755 --- a/tests/misc/nohup +++ b/tests/misc/nohup @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - nohup --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && nohup --version nohup sh -c 'echo stdout; echo stderr 1>&2' 2>err || fail=1 diff --git a/tests/misc/nproc-avail b/tests/misc/nproc-avail index ea4ba976c..424bbe043 100755 --- a/tests/misc/nproc-avail +++ b/tests/misc/nproc-avail @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - nproc --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && nproc --version all=$(nproc --all) available=$(OMP_NUM_THREADS= nproc) diff --git a/tests/misc/nproc-positive b/tests/misc/nproc-positive index 03157c51b..1f12c9b96 100755 --- a/tests/misc/nproc-positive +++ b/tests/misc/nproc-positive @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - nproc --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && nproc --version for mode in --all ''; do procs=$(nproc $mode) diff --git a/tests/misc/od-N b/tests/misc/od-N index 037ea371c..6d09f8e98 100755 --- a/tests/misc/od-N +++ b/tests/misc/od-N @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - od --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && od --version echo abcdefg > in || framework_failure diff --git a/tests/misc/od-multiple-t b/tests/misc/od-multiple-t index bc482d9f5..0aecaf05b 100755 --- a/tests/misc/od-multiple-t +++ b/tests/misc/od-multiple-t @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - od --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && od --version # Choose 48 bytes for the input, as that is lcm for 1, 2, 4, 8, 12, 16; # we don't anticipate any other native object size on modern hardware. diff --git a/tests/misc/od-x8 b/tests/misc/od-x8 index f25669efe..d9c933800 100755 --- a/tests/misc/od-x8 +++ b/tests/misc/od-x8 @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - od --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && od --version od -t x8 /dev/null >/dev/null || skip_test_ "od lacks support for 8-byte quantities" diff --git a/tests/misc/pathchk1 b/tests/misc/pathchk1 index cc0def866..ae32c9c29 100755 --- a/tests/misc/pathchk1 +++ b/tests/misc/pathchk1 @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - pathchk --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && pathchk --version skip_if_root_ touch file || framework_failure diff --git a/tests/misc/ptx-overrun b/tests/misc/ptx-overrun index 7cd5f8477..637c61d13 100755 --- a/tests/misc/ptx-overrun +++ b/tests/misc/ptx-overrun @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - ptx --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ptx --version # Using a long file name makes an abort more likely. # Even with no file name, valgrind detects the buffer overrun. diff --git a/tests/misc/readlink-fp-loop b/tests/misc/readlink-fp-loop index dfb2ba19a..ab66fa12a 100755 --- a/tests/misc/readlink-fp-loop +++ b/tests/misc/readlink-fp-loop @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - readlink --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && readlink --version cwd=$("$abs_top_builddir/src/pwd") # To trigger this bug, we have to construct a name/situation during diff --git a/tests/misc/runcon-no-reorder b/tests/misc/runcon-no-reorder index c38c91d3c..ee20df041 100755 --- a/tests/misc/runcon-no-reorder +++ b/tests/misc/runcon-no-reorder @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - runcon --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && runcon --version diag='runcon: runcon may be used only on a SELinux kernel' echo "$diag" > exp || framework_failure diff --git a/tests/misc/seq-long-double b/tests/misc/seq-long-double index f9450a2ea..e07ea82db 100755 --- a/tests/misc/seq-long-double +++ b/tests/misc/seq-long-double @@ -18,12 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - seq --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && seq --version getlimits_ # Run this test only with glibc and sizeof (long double) > sizeof (double). diff --git a/tests/misc/shred-exact b/tests/misc/shred-exact index 289b4544c..2aeef77ac 100755 --- a/tests/misc/shred-exact +++ b/tests/misc/shred-exact @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - shred --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && shred --version for opt in --exact --zero; do diff --git a/tests/misc/shred-passes b/tests/misc/shred-passes index 8d92c053a..2298553eb 100755 --- a/tests/misc/shred-passes +++ b/tests/misc/shred-passes @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - shred --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && shred --version # shred a single letter, zero length file which should result in diff --git a/tests/misc/shred-remove b/tests/misc/shred-remove index fbd30aaea..0e2423cff 100755 --- a/tests/misc/shred-remove +++ b/tests/misc/shred-remove @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - shred --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && shred --version skip_if_root_ # The length of the basename is what matters. diff --git a/tests/misc/shuf b/tests/misc/shuf index 6adaae37f..e612ee0bc 100755 --- a/tests/misc/shuf +++ b/tests/misc/shuf @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - shuf --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && shuf --version seq 100 > in || framework_failure diff --git a/tests/misc/sort-compress b/tests/misc/sort-compress index 5ad28d69d..bba07604d 100755 --- a/tests/misc/sort-compress +++ b/tests/misc/sort-compress @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - sort --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && sort --version seq -w 2000 > exp || framework_failure tac exp > in || framework_failure diff --git a/tests/misc/sort-continue b/tests/misc/sort-continue index c68ceece1..e4b8adfb3 100755 --- a/tests/misc/sort-continue +++ b/tests/misc/sort-continue @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - sort --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && sort --version # Skip the test when running under valgrind. ( ulimit -n 6; sort < /dev/null ) \ diff --git a/tests/misc/sort-debug-keys b/tests/misc/sort-debug-keys index 1dd3895c9..ee65a7284 100755 --- a/tests/misc/sort-debug-keys +++ b/tests/misc/sort-debug-keys @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - sort --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && sort --version number() { cat -n | sed 's/^ *//'; } diff --git a/tests/misc/sort-debug-warn b/tests/misc/sort-debug-warn index 1ba6c0479..67668a135 100755 --- a/tests/misc/sort-debug-warn +++ b/tests/misc/sort-debug-warn @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - sort --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && sort --version cat <<\EOF > exp sort: using simple byte comparison diff --git a/tests/misc/sort-float b/tests/misc/sort-float index 04071598f..bd6a9b88b 100755 --- a/tests/misc/sort-float +++ b/tests/misc/sort-float @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - sort --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && sort --version # Return 0 if LDBL_MIN is smaller than DBL_MIN, else 1. # Dissect numbers like these, comparing first exponent, then diff --git a/tests/misc/sort-merge-fdlimit b/tests/misc/sort-merge-fdlimit index 56b851811..89a408490 100755 --- a/tests/misc/sort-merge-fdlimit +++ b/tests/misc/sort-merge-fdlimit @@ -17,12 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - sort --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && sort --version require_ulimit_ mkdir in err || framework_failure diff --git a/tests/misc/sort-month b/tests/misc/sort-month index 5ac6afde5..c0fb2eb91 100755 --- a/tests/misc/sort-month +++ b/tests/misc/sort-month @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - sort --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && sort --version locale --version >/dev/null 2>&1 || skip_test_ 'The locale utility is not present' diff --git a/tests/misc/sort-rand b/tests/misc/sort-rand index cead49ef5..07169e3c6 100755 --- a/tests/misc/sort-rand +++ b/tests/misc/sort-rand @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - sort --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && sort --version seq 100 > in || framework_failure diff --git a/tests/misc/sort-version b/tests/misc/sort-version index 741ee8b27..e6a07c27b 100755 --- a/tests/misc/sort-version +++ b/tests/misc/sort-version @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - sort --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && sort --version cat > in << _EOF_ gcc-c++-10.fc9.tar.gz diff --git a/tests/misc/split-a b/tests/misc/split-a index 2fefff59d..27269e2db 100755 --- a/tests/misc/split-a +++ b/tests/misc/split-a @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - split --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && split --version a_z='a b c d e f g h i j k l m n o p q r s t u v w x y z' diff --git a/tests/misc/split-fail b/tests/misc/split-fail index 0ce6f5734..ec1941691 100755 --- a/tests/misc/split-fail +++ b/tests/misc/split-fail @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - split --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && split --version getlimits_ touch in || framework_failure diff --git a/tests/misc/split-l b/tests/misc/split-l index fb07a27a0..2e64a2c93 100755 --- a/tests/misc/split-l +++ b/tests/misc/split-l @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - ln --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ln --version printf '1\n2\n3\n4\n5\n' > in || framework_failure diff --git a/tests/misc/stat-fmt b/tests/misc/stat-fmt index 3133c5103..5e58ea46a 100755 --- a/tests/misc/stat-fmt +++ b/tests/misc/stat-fmt @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - stat --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && stat --version diff --git a/tests/misc/stat-hyphen b/tests/misc/stat-hyphen index ea68b08fa..2e0fdd29a 100755 --- a/tests/misc/stat-hyphen +++ b/tests/misc/stat-hyphen @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - stat --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && stat --version printf -- '-\n' > exp || framework_failure touch f || framework_failure diff --git a/tests/misc/stat-slash b/tests/misc/stat-slash index 7210f92fd..4f0660f22 100755 --- a/tests/misc/stat-slash +++ b/tests/misc/stat-slash @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - stat --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && stat --version touch file || framework_failure mkdir dir || framework_failure diff --git a/tests/misc/stty-invalid b/tests/misc/stty-invalid index 0537568bf..d80e3d413 100755 --- a/tests/misc/stty-invalid +++ b/tests/misc/stty-invalid @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - stty --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && stty --version require_controlling_input_terminal_ trap '' TTOU # Ignore SIGTTOU diff --git a/tests/misc/tac-continue b/tests/misc/tac-continue index 5bf709f78..59dddc83e 100755 --- a/tests/misc/tac-continue +++ b/tests/misc/tac-continue @@ -18,12 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - tac --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tac --version # See if the envvar is defined. if test x = "x$FULL_PARTITION_TMPDIR"; then diff --git a/tests/misc/tee b/tests/misc/tee index 6c4c85904..9562966ae 100755 --- a/tests/misc/tee +++ b/tests/misc/tee @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - tee --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tee --version echo line >sample || framework_failure nums=`seq 9` || framework_failure diff --git a/tests/misc/tee-dash b/tests/misc/tee-dash index ba688c00d..e72eadeef 100755 --- a/tests/misc/tee-dash +++ b/tests/misc/tee-dash @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - tee --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && tee --version tee - . -if test "$VERBOSE" = yes; then - set -x - timeout --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && timeout --version # no timeout timeout 10 true || fail=1 diff --git a/tests/misc/timeout-parameters b/tests/misc/timeout-parameters index 42d7b13b2..c5949e62b 100755 --- a/tests/misc/timeout-parameters +++ b/tests/misc/timeout-parameters @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - timeout --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && timeout --version getlimits_ diff --git a/tests/misc/truncate-dangling-symlink b/tests/misc/truncate-dangling-symlink index 3499da755..801b55d17 100755 --- a/tests/misc/truncate-dangling-symlink +++ b/tests/misc/truncate-dangling-symlink @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - truncate --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && truncate --version ln -s truncate-target t-symlink diff --git a/tests/misc/truncate-dir-fail b/tests/misc/truncate-dir-fail index fe33857a2..cc94dc4bc 100755 --- a/tests/misc/truncate-dir-fail +++ b/tests/misc/truncate-dir-fail @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - truncate --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && truncate --version # truncate on dir not allowed truncate -s+0 . && fail=1 diff --git a/tests/misc/truncate-fail-diag b/tests/misc/truncate-fail-diag index 5ce248113..68a384236 100755 --- a/tests/misc/truncate-fail-diag +++ b/tests/misc/truncate-fail-diag @@ -20,12 +20,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - truncate --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && truncate --version skip_if_root_ diff --git a/tests/misc/truncate-fifo b/tests/misc/truncate-fifo index a4c36cb90..469ba5e97 100755 --- a/tests/misc/truncate-fifo +++ b/tests/misc/truncate-fifo @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - truncate --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && truncate --version mkfifo_or_skip_ fifo diff --git a/tests/misc/truncate-no-create-missing b/tests/misc/truncate-no-create-missing index aa43d8026..c5a87c2d0 100755 --- a/tests/misc/truncate-no-create-missing +++ b/tests/misc/truncate-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 . -if test "$VERBOSE" = yes; then - set -x - truncate --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && truncate --version # truncate -c no-such-file should not fail. diff --git a/tests/misc/truncate-overflow b/tests/misc/truncate-overflow index 0e9519f64..991c1c83f 100755 --- a/tests/misc/truncate-overflow +++ b/tests/misc/truncate-overflow @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - truncate --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && truncate --version getlimits_ diff --git a/tests/misc/truncate-parameters b/tests/misc/truncate-parameters index c2f701970..980ebffab 100755 --- a/tests/misc/truncate-parameters +++ b/tests/misc/truncate-parameters @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - truncate --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && truncate --version # must specify at least 1 file diff --git a/tests/misc/truncate-relative b/tests/misc/truncate-relative index 9d589564f..a82fd9c32 100755 --- a/tests/misc/truncate-relative +++ b/tests/misc/truncate-relative @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - truncate --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && truncate --version # mixture of relative modifiers not allowed diff --git a/tests/misc/wc-files0 b/tests/misc/wc-files0 index eb2aaa649..7d3634e95 100755 --- a/tests/misc/wc-files0 +++ b/tests/misc/wc-files0 @@ -16,12 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if test "$VERBOSE" = yes; then - set -x - wc --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && wc --version echo 2 > 2b || framework_failure echo 2 words > 2w || framework_failure -- cgit v1.2.3-54-g00ecf