]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Convert tests/ls/, too.
authorJim Meyering <jim@meyering.net>
Sat, 8 Sep 2007 08:09:19 +0000 (10:09 +0200)
committerJim Meyering <jim@meyering.net>
Sat, 15 Sep 2007 06:40:38 +0000 (08:40 +0200)
19 files changed:
tests/ls/Makefile.am
tests/ls/color-dtype-dir
tests/ls/dangle
tests/ls/dired
tests/ls/file-type
tests/ls/follow-slink
tests/ls/infloop
tests/ls/inode
tests/ls/m-option
tests/ls/nameless-uid
tests/ls/no-arg
tests/ls/recursive
tests/ls/rt-1
tests/ls/stat-dtype
tests/ls/stat-failed
tests/ls/stat-free-symlinks
tests/ls/stat-vs-dirent
tests/ls/symlink-slash
tests/ls/x-option

index b2aca8b5a931349640e23c61204dd6e3e7291c8b..9ef4afa9c0f35a003c501ce37d5a426a24dde06e 100644 (file)
@@ -33,3 +33,5 @@ TESTS_ENVIRONMENT = \
   PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" \
   PERL="$(PERL)" \
   PROG=ls
+
+include $(top_srcdir)/tests/check.mk
index 38b1e38edb052572df3b9b1bbc1fcb7f5084d1a7..7a25c06d35bb7c4e4dd42aa231e5110e20783472 100755 (executable)
@@ -24,28 +24,14 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-. $srcdir/../envvar-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
+. $srcdir/../test-lib.sh
 
 # Don't let a different umask perturb the results.
 umask 22
 
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-mkdir d other-writable sticky || framework_failure=1
-chmod o+w other-writable || framework_failure=1
-chmod o+t sticky || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+mkdir d other-writable sticky || framework_failure
+chmod o+w other-writable || framework_failure
+chmod o+t sticky || framework_failure
 
 fail=0
 
@@ -62,7 +48,6 @@ cat <<\EOF > exp || fail=1
 ^[[m
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 950cd4fd6f723ef97e6d0b1e53a1ba8e37805f2c..bd3633fab8fdcbde7d9a6364192e7374d252b979 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Make sure ls properly handles dangling symlinks vs. ls's -L, -H, options.
 
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,22 +21,11 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-ln -s no-such-file dangle || framework_failure=1
-mkdir -p dir/sub || framework_failure=1
-ln -s dir slink-to-dir || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+ln -s no-such-file dangle || framework_failure
+mkdir -p dir/sub || framework_failure
+ln -s dir slink-to-dir || framework_failure
 
 fail=0
 
@@ -59,7 +48,6 @@ sub
 sub
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 0889c973b2d981eb7d1a59659d90c55b9475b1ae..45cbdfcc736d560f3762481852503434d3cb3d19 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # make sure --dired option works
 
-# Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001-2002, 2004, 2006-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,22 +21,9 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
 
-pwd=`pwd`
-tmp=dired.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir dir || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo 'failure in testing framework' 1>&2
-  (exit 1); exit 1
-fi
+mkdir dir || framework_failure
 
 fail=0
 
@@ -48,7 +35,6 @@ cat <<EOF > exp
 //DIRED-OPTIONS// --quoting-style=literal
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index b9286c207d4aa1020f685cde284ed58dd57356af..533bec89c2f5dfeb768448d6a0baebe04aba6f8b 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # contrast ls -F, ls -p, and ls --indicator-style=file-type
 
-# Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2005-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,17 +21,9 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-. $srcdir/../envvar-check
 . $srcdir/../lang-default
+. $srcdir/../test-lib.sh
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
 mkdir sub
 cd sub
 mkdir dir
@@ -48,11 +40,6 @@ mkfifo fifo
 cd ..
 
 
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
-
 fail=0
 
 ls -F sub > out || fail=1
@@ -72,17 +59,13 @@ ls --indicator-style=file-type sub > out2 || fail=1
 sed 's/[@|]$//' exp2 > exp3
 ls -p sub > out3 || fail=1
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
-cmp out2 exp2 || fail=1
-test $fail = 1 && diff out2 exp2 2> /dev/null
+compare out2 exp2 || fail=1
 
-cmp out3 exp3 || fail=1
-test $fail = 1 && diff out3 exp3 2> /dev/null
+compare out3 exp3 || fail=1
 
 ls --color=auto -F sub > out || fail=1
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 2165c62e647840b70c33f4c9b983b3372a196c62..a7efadb17f35230ca3ad68b9469bb99bf948f15a 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # make sure ls -L always follows symlinks
 
-# Copyright (C) 2000, 2002, 2004, 20062007 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2002, 2004, 2006-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,30 +21,18 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-pwd=`pwd`
-tmp=follow-sl.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
+. $srcdir/../test-lib.sh
 
 # Isolate output files from directory being listed
-mkdir dir dir/sub dir1 || framework_failure=1
-cd dir || framework_failure=1
-ln -s link link || framework_failure=1
-ln -s ../../dir1 sub/link-to-dir || framework_failure=1
+mkdir dir dir/sub dir1 || framework_failure
+cd dir || framework_failure
+ln -s link link || framework_failure
+ln -s ../../dir1 sub/link-to-dir || framework_failure
 
 # Make sure the symlink was created.
 # `ln -s link link' succeeds, but creates no file on
 # systems running some DJGPP-2.03 libc.
-ls -F link > /dev/null || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo 'failure in testing framework'
-  (exit 1); exit 1
-fi
+ls -F link > /dev/null || framework_failure
 
 fail=0
 
@@ -72,13 +60,7 @@ link-to-dir/
 sub/link-to-dir:
 EOF
 
-cmp out-L exp-L || {
-  fail=1
-  diff out-L exp-L
-}
-cmp out-FLR-sub exp-FLR-sub || {
-  fail=1
-  diff out-FLR-sub exp-FLR-sub
-}
+compare out-L exp-L || fail=1
+compare out-FLR-sub exp-FLR-sub || fail=1
 
 (exit $fail); exit $fail
index 209fd350c847de6795737495d060d0defd3b4393..cc93372c7d7d27001f4ee3945b1866ddd1b2ee77 100755 (executable)
@@ -2,7 +2,7 @@
 # show that the following no longer makes ls infloop
 # mkdir loop; cd loop; ln -s ../loop sub; ls -RL
 
-# Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001-2002, 2004, 2006-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -23,22 +23,10 @@ if test "$VERBOSE" = yes; then
 fi
 
 . $srcdir/../lang-default
+. $srcdir/../test-lib.sh
 
-pwd=`pwd`
-tmp=infloop.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir loop || framework_failure=1
-ln -s ../loop loop/sub || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo 'failure in testing framework' 1>&2
-  (exit 1); exit 1
-fi
+mkdir loop || framework_failure
+ln -s ../loop loop/sub || framework_failure
 
 fail=0
 
@@ -54,6 +42,7 @@ sub
 loop/sub/sub:
 EOF
 
-cmp out bad 2>/dev/null && fail=1
+# Make sure we don't get the "bad" output.
+compare out bad > /dev/null 2>&1 && fail=1
 
 (exit $fail); exit $fail
index c920dccd628063e5f45a42216fa402fc05a6450a..08ee5e1f798a171a79e84ebab12bf4e3f66f3f75 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Make sure that ls -i works properly on symlinks.
 
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,21 +21,10 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch f || framework_failure=1
-ln -s f slink || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+touch f || framework_failure
+ln -s f slink || framework_failure
 
 fail=0
 
index 6f77387412d0301f8a7230bf50598006192061b7..db6e53393b1c3c3ebdcaaeabf9a16fe25674ade5 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # exercise the -m option
 
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,23 +21,10 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-seq 2000 > b || framework_failure=1
-touch a || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+seq 2000 > b || framework_failure
+touch a || framework_failure
 
 fail=0
 
@@ -53,7 +40,6 @@ b
 0 a, 12 b
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 09e2b81760502f24da70c1de7e2a9a0f7b4c7d9a..7512c187d26daae321f06c250ec3223972766168 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Ensure that ls -l works on files with nameless uid and/or gid
 
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,9 +21,9 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-. $srcdir/../envvar-check
 . $srcdir/../lang-default
 PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
 
 $PERL -e 1 > /dev/null 2>&1 || {
   echo 1>&2 "$0: configure didn't find a usable version of Perl," \
@@ -38,22 +38,8 @@ if test x$nameless_uid = x; then
   (exit 77); exit 77
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-touch f || framework_failure=1
-chown $nameless_uid f || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+touch f || framework_failure
+chown $nameless_uid f || framework_failure
 
 fail=0
 
index 13f72b4947d8dbbf28f4a35fc44f22d94090aa74..00b4d92b89ba4837906178595c4e9ba9a6d6cb16 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # make sure ls and `ls -R' do the right thing when invoked with no arguments.
 
-# Copyright (C) 2001, 2003, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2004, 2006-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,36 +21,24 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-pwd=`pwd`
-tmp=no-args.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir -p dir/subdir || framework_failure=1
-touch dir/subdir/file2 || framework_failure=1
-ln -s f symlink || framework_failure=1
+mkdir -p dir/subdir || framework_failure
+touch dir/subdir/file2 || framework_failure
+ln -s f symlink || framework_failure
 
-cat > exp <<\EOF || framework_failure=1
+cat > exp <<\EOF || framework_failure
 dir
 exp
 out
 symlink
 EOF
 
-if test $framework_failure = 1; then
-  echo 'failure in testing framework'
-  (exit 1); exit 1
-fi
-
 fail=0
 
 ls -1 > out || fail=1
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 cat > exp <<\EOF
 .:
@@ -68,7 +56,6 @@ EOF
 
 ls -R1 > out || fail=1
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 6e4cedd8866a076e6a61073f59e8b7771fe445a0..8aff3ed7e488a437c97417e7a99ef617d7e4a0d4 100755 (executable)
@@ -2,7 +2,7 @@
 # 4.1.1 and 4.1.2 had a bug whereby some recursive listings
 # didn't include a blank line between per-directory groups of files.
 
-# Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 2006-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -22,24 +22,10 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
 
-pwd=`pwd`
-tmp=recursive.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-mkdir x y a b c a/1 a/2 a/3 || framework_failure=1
-touch f a/1/I a/1/II || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+mkdir x y a b c a/1 a/2 a/3 || framework_failure
+touch f a/1/I a/1/II || framework_failure
 
 fail=0
 
@@ -64,8 +50,7 @@ b:
 c:
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 rm -rf out exp
 ls -R1 x y f > out || fail=1
@@ -77,7 +62,6 @@ x:
 y:
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index bf1ed955e8a359b25028bb504d48ff6996693a76..dce7c852d2241dd5f62670b542594dc36ac8d79a 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Make sure name is used as secondary key when sorting on mtime or ctime.
 
-# Copyright (C) 1998, 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001-2002, 2004, 2006-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,7 +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/>.
 
-. $srcdir/../envvar-check
 . $srcdir/../lang-default
 
 if test "$VERBOSE" = yes; then
@@ -25,25 +24,13 @@ if test "$VERBOSE" = yes; then
   touch --version
 fi
 
-pwd=`pwd`
-tmp=t-ls.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
+. $srcdir/../test-lib.sh
 
 date=1998-01-15
 
-touch -d "$date" c || framework_failure=1
-touch -d "$date" a || framework_failure=1
-touch -d "$date" b || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+touch -d "$date" c || framework_failure
+touch -d "$date" a || framework_failure
+touch -d "$date" b || framework_failure
 
 fail=0
 
@@ -53,8 +40,7 @@ a
 b
 c
 EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 rm -rf out exp
 ls -1rt a b c > out || fail=1
@@ -63,7 +49,6 @@ c
 b
 a
 EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 3c8a681f5a75b513a9d9a2e9f493f1a6682072e6..c5ea4f567d6fc62b97321d1a5fc11828b6f2602c 100755 (executable)
@@ -3,7 +3,7 @@
 # Also check for the dtype-related (and fs-type dependent) bug
 # in coreutils-6.0 that made ls -CF columns misaligned.
 
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -26,39 +26,25 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-. $srcdir/../envvar-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
+. $srcdir/../test-lib.sh
 
 # 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,
 # but if ls's d_type code is buggy then "ls -p" might be buggy too.
-mkdir -p c/d || framework_failure=1
-chmod a-x c || framework_failure=1
+mkdir -p c/d || framework_failure
+chmod a-x c || framework_failure
 if test "X`ls -p c 2>&1`" != Xd/; then
   echo "$0: '.' is not on a suitable file system for this test" 1>&2
   echo "$0: skipping this test" 1>&2
   (exit 77); exit 77
 fi
 
-mkdir d || framework_failure=1
-ln -s / d/s || framework_failure=1
-chmod 600 d || framework_failure=1
+mkdir d || framework_failure
+ln -s / d/s || framework_failure
+chmod 600 d || framework_failure
 
-mkdir -p e/a2345 e/b || framework_failure=1
-chmod 600 e || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+mkdir -p e/a2345 e/b || framework_failure
+chmod 600 e || framework_failure
 
 fail=0
 
@@ -67,8 +53,7 @@ cat <<\EOF > exp || fail=1
 s@
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 rm -f out exp
 # Check for the ls -CF misaligned-columns bug:
@@ -78,7 +63,6 @@ ls -CF e > out || fail=1
 # rather than the appropriate TAB.
 printf 'a2345/\tb/\n' > exp || fail=1
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 342fc2a80069bd0b2eb873bf1a97cf263dd8442c..02c3bf19c1d8a9eac2c3bb58ddf6f50f68234ae6 100755 (executable)
@@ -2,7 +2,7 @@
 # Verify that ls works properly when it fails to stat a file that is
 # not mentioned on the command line.
 
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -22,26 +22,13 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-. $srcdir/../envvar-check
 . $srcdir/../lang-default
 PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir d || framework_failure=1
-ln -s / d/s || framework_failure=1
-chmod 600 d || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+mkdir d || framework_failure
+ln -s / d/s || framework_failure
+chmod 600 d || framework_failure
 
 fail=0
 
@@ -53,8 +40,7 @@ total 0
 ?????????? ? ?            ? s
 EOF
 
-sed 's/^l/?/' out | cmp - exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+sed 's/^l/?/' out | compare - exp || fail=1
 
 # Ensure that the offsets in --dired output are accurate.
 rm -f out exp
@@ -67,7 +53,6 @@ cat <<\EOF > exp || fail=1
 //DIRED-OPTIONS// --quoting-style=literal
 EOF
 
-sed 's/^  l/  ?/' out | cmp - exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+sed 's/^  l/  ?/' out | compare - exp || fail=1
 
 (exit $fail); exit $fail
index 1d654822b6ed29c321802d9eb93e24f478aa9d8f..7c0fce927493213fb84e4206b6b026c65e59357c 100755 (executable)
@@ -21,26 +21,12 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-. $srcdir/../envvar-check
 . $srcdir/../strace
+. $srcdir/../test-lib.sh
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-touch x || framework_failure=1
-chmod a+x x || framework_failure=1
-ln -s x link-to-x || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+touch x || framework_failure
+chmod a+x x || framework_failure
+ln -s x link-to-x || framework_failure
 
 fail=0
 
@@ -64,7 +50,6 @@ test -s err && fail=1
   printf '\033[m'
 } > exp || fail=1
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 80ffc5a4c7b5c63dda4fe7fff84755056b5b1837..c326bc9fa0f6b33e88305b81506cde164648fb87 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Ensure that d_ino (from ls -di) and st_ino (from stat --format=%i) match.
 
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,21 +21,7 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-. $srcdir/../envvar-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 fail=0
 
index 23566e35de468f822db1cb1a15821e4fc48759fe..8deba05111d9d2aa7104980b1215791ca42be05c 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Do dereference a symlink arg if its name is written with a trailing slash.
 
-# Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2004, 2007 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,22 +21,11 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-. $srcdir/../envvar-check
 . $srcdir/../lang-default
+. $srcdir/../test-lib.sh
 
-tmp=t-ls.$$
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-mkdir dir || framework_failure=1
-ln -s dir symlink || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo 'failure in testing framework'
-  exit 1
-fi
+mkdir dir || framework_failure
+ln -s dir symlink || framework_failure
 
 fail=0
 set `ls -l symlink/`
@@ -44,7 +33,4 @@ set `ls -l symlink/`
 # Prior to fileutils-4.0k, the following would have output `... symlink -> dir'.
 test "$*" = 'total 0' && : || fail=1
 
-cd ..
-rm -rf $tmp
-
 exit $fail
index a0c41c24d7a74a475ed3b90a91d0bb587c252c64..4fb27047ca3e91e40abbf2109775e717b62c7351 100755 (executable)
@@ -21,25 +21,12 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-. $srcdir/../envvar-check
 . $srcdir/../lang-default
+. $srcdir/../test-lib.sh
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir subdir || framework_failure=1
-touch subdir/b || framework_failure=1
-touch subdir/a || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+mkdir subdir || framework_failure
+touch subdir/b || framework_failure
+touch subdir/a || framework_failure
 
 fail=0
 
@@ -51,7 +38,6 @@ a  b
 b  a
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail