summaryrefslogtreecommitdiff
path: root/tests/ls
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-11-14 11:05:05 +0100
committerJim Meyering <meyering@redhat.com>2010-11-17 20:48:57 +0100
commitf38becab02472e6872048a1951b249b2a3c054df (patch)
treee5b531384b55abae8b1829ada892891bfee58fe3 /tests/ls
parent30b74dfff16240ea0e4a4c5b705f1e9631e5d0a7 (diff)
downloadcoreutils-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/ls')
-rwxr-xr-xtests/ls/abmon-align8
-rwxr-xr-xtests/ls/capability8
-rwxr-xr-xtests/ls/color-clear-to-eol8
-rwxr-xr-xtests/ls/color-dtype-dir8
-rwxr-xr-xtests/ls/color-norm8
-rwxr-xr-xtests/ls/dangle8
-rwxr-xr-xtests/ls/dired8
-rwxr-xr-xtests/ls/file-type8
-rwxr-xr-xtests/ls/follow-slink8
-rwxr-xr-xtests/ls/infloop8
-rwxr-xr-xtests/ls/inode8
-rwxr-xr-xtests/ls/m-option8
-rwxr-xr-xtests/ls/multihardlink8
-rwxr-xr-xtests/ls/no-arg8
-rwxr-xr-xtests/ls/no-cap8
-rwxr-xr-xtests/ls/proc-selinux-segfault8
-rwxr-xr-xtests/ls/readdir-mountpoint-inode8
-rwxr-xr-xtests/ls/recursive8
-rwxr-xr-xtests/ls/stat-dtype8
-rwxr-xr-xtests/ls/stat-failed8
-rwxr-xr-xtests/ls/stat-free-symlinks8
-rwxr-xr-xtests/ls/stat-vs-dirent8
-rwxr-xr-xtests/ls/symlink-slash8
-rwxr-xr-xtests/ls/x-option8
24 files changed, 48 insertions, 144 deletions
diff --git a/tests/ls/abmon-align b/tests/ls/abmon-align
index 9b50d5e4d..21c22f480 100755
--- a/tests/ls/abmon-align
+++ b/tests/ls/abmon-align
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
for mon in $(seq -w 12); do
touch -d"+$mon month" $mon.ts || framework_failure
diff --git a/tests/ls/capability b/tests/ls/capability
index 3997c731e..200060ae8 100755
--- a/tests/ls/capability
+++ b/tests/ls/capability
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
require_root_
grep '^#define HAVE_CAP 1' $CONFIG_HEADER > /dev/null \
diff --git a/tests/ls/color-clear-to-eol b/tests/ls/color-clear-to-eol
index 1be68cab6..683ee4e9f 100755
--- a/tests/ls/color-clear-to-eol
+++ b/tests/ls/color-clear-to-eol
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
long_name=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.foo
touch $long_name || framework_failure
diff --git a/tests/ls/color-dtype-dir b/tests/ls/color-dtype-dir
index 29b872c21..b691ae75c 100755
--- a/tests/ls/color-dtype-dir
+++ b/tests/ls/color-dtype-dir
@@ -19,12 +19,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
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
# Don't let a different umask perturb the results.
umask 22
diff --git a/tests/ls/color-norm b/tests/ls/color-norm
index e7a68299e..9d946a09b 100755
--- a/tests/ls/color-norm
+++ b/tests/ls/color-norm
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
# Don't let a different umask perturb the results.
umask 22
diff --git a/tests/ls/dangle b/tests/ls/dangle
index f7d97833a..f544df266 100755
--- a/tests/ls/dangle
+++ b/tests/ls/dangle
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
ln -s no-such-file dangle || framework_failure
mkdir -p dir/sub || framework_failure
diff --git a/tests/ls/dired b/tests/ls/dired
index 1d9c0ee1b..b59426d83 100755
--- a/tests/ls/dired
+++ b/tests/ls/dired
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
mkdir dir || framework_failure
diff --git a/tests/ls/file-type b/tests/ls/file-type
index 7557166ba..07a8cd433 100755
--- a/tests/ls/file-type
+++ b/tests/ls/file-type
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
mkdir sub
cd sub
diff --git a/tests/ls/follow-slink b/tests/ls/follow-slink
index afa9947d8..00e49bac9 100755
--- a/tests/ls/follow-slink
+++ b/tests/ls/follow-slink
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
# Isolate output files from directory being listed
mkdir dir dir/sub dir1 || framework_failure
diff --git a/tests/ls/infloop b/tests/ls/infloop
index b237adc39..be89efcab 100755
--- a/tests/ls/infloop
+++ b/tests/ls/infloop
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
mkdir loop || framework_failure
ln -s ../loop loop/sub || framework_failure
diff --git a/tests/ls/inode b/tests/ls/inode
index 16a80f25b..08ae0f8b9 100755
--- a/tests/ls/inode
+++ b/tests/ls/inode
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
touch f || framework_failure
ln -s f slink || framework_failure
diff --git a/tests/ls/m-option b/tests/ls/m-option
index de73b8d80..b35e527d4 100755
--- a/tests/ls/m-option
+++ b/tests/ls/m-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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
seq 2000 > b || framework_failure
touch a || framework_failure
diff --git a/tests/ls/multihardlink b/tests/ls/multihardlink
index 20a94c807..46850e883 100755
--- a/tests/ls/multihardlink
+++ b/tests/ls/multihardlink
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
working_umask_or_skip_
touch file file1 || framework_failure
diff --git a/tests/ls/no-arg b/tests/ls/no-arg
index 9eb32dce3..288688b35 100755
--- a/tests/ls/no-arg
+++ b/tests/ls/no-arg
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
mkdir -p dir/subdir || framework_failure
touch dir/subdir/file2 || framework_failure
diff --git a/tests/ls/no-cap b/tests/ls/no-cap
index 04b99edbc..c82620269 100755
--- a/tests/ls/no-cap
+++ b/tests/ls/no-cap
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
require_strace_ capget
strace -e capget ls --color=always > /dev/null 2> out || fail=1
diff --git a/tests/ls/proc-selinux-segfault b/tests/ls/proc-selinux-segfault
index 4173ee84f..f0dbb96ad 100755
--- a/tests/ls/proc-selinux-segfault
+++ b/tests/ls/proc-selinux-segfault
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
f=/proc/sys
test -r $f || f=.
diff --git a/tests/ls/readdir-mountpoint-inode b/tests/ls/readdir-mountpoint-inode
index d03ba06f9..9a38627c9 100755
--- a/tests/ls/readdir-mountpoint-inode
+++ b/tests/ls/readdir-mountpoint-inode
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
# We use --local here so as to not activate
# potentially very many remote mounts.
diff --git a/tests/ls/recursive b/tests/ls/recursive
index fe82241ca..a216249d1 100755
--- a/tests/ls/recursive
+++ b/tests/ls/recursive
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
mkdir x y a b c a/1 a/2 a/3 || framework_failure
touch f a/1/I a/1/II || framework_failure
diff --git a/tests/ls/stat-dtype b/tests/ls/stat-dtype
index 6aaab5338..bfc51aad3 100755
--- a/tests/ls/stat-dtype
+++ b/tests/ls/stat-dtype
@@ -21,12 +21,8 @@
# The trick is to create an un-stat'able symlink and to see if ls
# can report its type nonetheless, using dirent.d_type.
-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
# Skip this test unless "." is on a file system with useful d_type info.
# FIXME: This uses "ls -p" to decide whether to test "ls" with other options,
diff --git a/tests/ls/stat-failed b/tests/ls/stat-failed
index 4a2b6c4a1..e7feba552 100755
--- a/tests/ls/stat-failed
+++ b/tests/ls/stat-failed
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
skip_if_root_
mkdir d || framework_failure
diff --git a/tests/ls/stat-free-symlinks b/tests/ls/stat-free-symlinks
index 7af9e344d..f9b6bb59f 100755
--- a/tests/ls/stat-free-symlinks
+++ b/tests/ls/stat-free-symlinks
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
require_strace_ stat
touch x || framework_failure
diff --git a/tests/ls/stat-vs-dirent b/tests/ls/stat-vs-dirent
index 25b2021e1..00a08140d 100755
--- a/tests/ls/stat-vs-dirent
+++ b/tests/ls/stat-vs-dirent
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
root_dev_ino=`stat --format=%d-%i /`
diff --git a/tests/ls/symlink-slash b/tests/ls/symlink-slash
index bacbc73d7..9db9ba61d 100755
--- a/tests/ls/symlink-slash
+++ b/tests/ls/symlink-slash
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
mkdir dir || framework_failure
ln -s dir symlink || framework_failure
diff --git a/tests/ls/x-option b/tests/ls/x-option
index 8d9658124..ed6ef625f 100755
--- a/tests/ls/x-option
+++ b/tests/ls/x-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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
mkdir subdir || framework_failure
touch subdir/b || framework_failure