summaryrefslogtreecommitdiff
path: root/tests/misc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/misc')
-rwxr-xr-xtests/misc/arch8
-rwxr-xr-xtests/misc/env-null9
-rwxr-xr-xtests/misc/md5sum-parallel7
-rwxr-xr-xtests/misc/printenv7
-rwxr-xr-xtests/misc/printf7
-rwxr-xr-xtests/misc/printf-hex12
-rwxr-xr-xtests/misc/printf-surprise7
-rwxr-xr-xtests/misc/pwd-long2
-rwxr-xr-xtests/misc/pwd-option6
-rwxr-xr-xtests/misc/pwd-unreadable-parent7
-rwxr-xr-xtests/misc/selinux11
-rwxr-xr-xtests/misc/stdbuf7
-rwxr-xr-xtests/misc/stty7
-rwxr-xr-xtests/misc/stty-row-col10
-rwxr-xr-xtests/misc/su-fail8
-rwxr-xr-xtests/misc/sum-sysv7
-rwxr-xr-xtests/misc/truncate-owned-by-other8
-rwxr-xr-xtests/misc/wc-parallel7
-rwxr-xr-xtests/misc/xattr8
19 files changed, 30 insertions, 115 deletions
diff --git a/tests/misc/arch b/tests/misc/arch
index b7164e455..a4475e6d0 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 53d1b62c5..ed2e21d58 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 0243e8503..6f38b8b1b 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 f0e2cd257..dd82c0509 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 e8e4f2e5d..cf376f3ba 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 e428d2605..39b70d6ef 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 581a6d47a..702ab67a3 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 570255239..c58207abe 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 c1a28fef8..e4ecf11f9 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 dc6dde418..1f3d914eb 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 3729024fa..0a8259fef 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 5822698ea..8302c4896 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 28dd90e12..0659d51a5 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 bb1153a2d..5acb3d0bb 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 c230f1754..4c57c945b 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 3de278414..705de2766 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 3a8bde037..86fd5288e 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 8afdb2aa6..47f10441c 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 21e0f1ccb..3a27f15e0 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