summaryrefslogtreecommitdiff
path: root/tests/ls
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2016-11-08 19:57:41 -0600
committerJim Meyering <meyering@fb.com>2016-11-13 08:26:19 -0800
commit22063c8c083d2d8130efb76482e45fa1976a595a (patch)
tree18645c547557304f18702e3c07b83fb3793ea135 /tests/ls
parent4d45722d1160a04e4d26fd812da4e0140ad3550c (diff)
downloadcoreutils-22063c8c083d2d8130efb76482e45fa1976a595a.tar.xz
tests: use "returns_" rather than explicit comparison with "$?"
* tests/chmod/no-x.sh: Likewise. * tests/cp/no-deref-link1.sh: Likewise. * tests/cp/no-deref-link2.sh: Likewise. * tests/cp/no-deref-link3.sh: Likewise. * tests/du/move-dir-while-traversing.sh: Likewise. * tests/ls/infloop.sh: Likewise. * tests/ls/stat-failed.sh: Likewise. * tests/ls/time-style-diag.sh: Likewise. * tests/misc/chroot-fail.sh: Likewise. * tests/misc/env-null.sh: Likewise. * tests/misc/env.sh: Likewise. * tests/misc/nice-fail.sh: Likewise. * tests/misc/printenv.sh: Likewise. * tests/misc/timeout.sh: Likewise. * tests/tail-2/follow-name.sh: Likewise.
Diffstat (limited to 'tests/ls')
-rwxr-xr-xtests/ls/infloop.sh3
-rwxr-xr-xtests/ls/stat-failed.sh3
-rwxr-xr-xtests/ls/time-style-diag.sh3
3 files changed, 3 insertions, 6 deletions
diff --git a/tests/ls/infloop.sh b/tests/ls/infloop.sh
index e06a9a4e6..a724d1195 100755
--- a/tests/ls/infloop.sh
+++ b/tests/ls/infloop.sh
@@ -32,9 +32,8 @@ cat <<\EOF > exp-err || framework_failure_
ls: loop/sub: not listing already-listed directory
EOF
-timeout 10 ls -RL loop >out 2>err
# Ensure that ls exits with status 2 upon detecting a cycle
-test $? = 2 || fail=1
+returns_ 2 timeout 10 ls -RL loop >out 2>err || fail=1
compare exp-err err || fail=1
compare exp-out out || fail=1
diff --git a/tests/ls/stat-failed.sh b/tests/ls/stat-failed.sh
index b0e11e668..2fb376d67 100755
--- a/tests/ls/stat-failed.sh
+++ b/tests/ls/stat-failed.sh
@@ -28,8 +28,7 @@ ln -s / d/s || framework_failure_
chmod 600 d || framework_failure_
-ls -Log d > out
-test $? = 1 || fail=1
+returns_ 1 ls -Log d > out || fail=1
# Linux 2.6.32 client with Isilon OneFS always returns d_type==DT_DIR ('d')
# Newer Linux 3.10.0 returns the more correct DT_UNKNOWN ('?')
diff --git a/tests/ls/time-style-diag.sh b/tests/ls/time-style-diag.sh
index 04be4dd7b..0630418ca 100755
--- a/tests/ls/time-style-diag.sh
+++ b/tests/ls/time-style-diag.sh
@@ -19,8 +19,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ ls
-ls -l --time-style=XX > out 2> err
-test $? = 2 || fail=1
+returns_ 2 ls -l --time-style=XX > out 2> err || fail=1
cat <<\EOF > exp || fail=1
ls: invalid argument 'XX' for 'time style'