Convert tests/mkdir/ to use test-lib.sh.
authorJim Meyering <jim@meyering.net>
Mon, 10 Sep 2007 06:00:39 +0000 (08:00 +0200)
committerJim Meyering <jim@meyering.net>
Sat, 15 Sep 2007 06:40:39 +0000 (08:40 +0200)
12 files changed:
tests/mkdir/Makefile.am
tests/mkdir/concurrent-1 [deleted file]
tests/mkdir/p-1
tests/mkdir/p-2
tests/mkdir/p-3
tests/mkdir/p-slashdot
tests/mkdir/p-thru-slink
tests/mkdir/p-v
tests/mkdir/parents
tests/mkdir/perm
tests/mkdir/special-1
tests/mkdir/t-slash

index fc2ab77..2cf08b2 100644 (file)
@@ -7,3 +7,5 @@ TESTS_ENVIRONMENT = \
   srcdir=$(srcdir) \
   CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
   PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH"
+
+include $(top_srcdir)/tests/check.mk
diff --git a/tests/mkdir/concurrent-1 b/tests/mkdir/concurrent-1
deleted file mode 100755 (executable)
index 5daba11..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-# Test whether "mkdir -p" works concurrently.
-
-# Copyright (C) 1999, 2000, 2002, 2006 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
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# TMPDIR should be an absolute dir for this test.
-# FIXME: enforce it
-: ${TMPDIR=/tmp}
-
-if test "$VERBOSE" = yes; then
-  set -x
-  mkdir --version
-fi
-
-pwd=`pwd`
-tmp=`echo "$0"|sed 's,.*/,,'`.tmp
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-mkdir --parents "$pwd/$tmp/a/b/c" || fail=1
-
-test -d $tmp || fail=1
-
-exit $fail
index 43e1805..7ef63be 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Test "mkdir -p".
 
-# Copyright (C) 1997, 2000, 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2000, 2002, 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,13 +21,10 @@ if test "$VERBOSE" = yes; then
   mkdir --version
 fi
 
-pwd=`pwd`
-tmp=`echo "$0"|sed 's,.*/,,'`.tmp
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-mkdir --parents "$pwd/$tmp" || fail=1
-
-test -d $tmp || fail=1
+fail=0
+mkdir --parents "`pwd`/t" || fail=1
+test -d t || fail=1
 
 exit $fail
index d7b9554..f19a50c 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Just like p-1, but with an absolute path.
 
-# Copyright (C) 1997, 2000, 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2000, 2002, 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,13 +21,10 @@ if test "$VERBOSE" = yes; then
   mkdir --version
 fi
 
-pwd=`pwd`
-tmp=`echo "$0"|sed 's,.*/,,'`.tmp
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-mkdir --parents $tmp || fail=1
-
-test -d $tmp || fail=1
+fail=0
+mkdir --parents "`pwd`/t/u" || fail=1
+test -d t/u || fail=1
 
 exit $fail
index 88b53ee..ff011e6 100755 (executable)
@@ -24,25 +24,13 @@ if test "$VERBOSE" = yes; then
 fi
 
 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
+mkdir no-access || framework_failure
+mkdir no-acce2s || framework_failure
+mkdir -p no-acce3s/d || framework_failure
 
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir no-access || framework_failure=1
-mkdir no-acce2s || framework_failure=1
-mkdir -p no-acce3s/d || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
-
-p=$pwd/$tmp
+p=`pwd`
 (cd no-access && chmod 0 . && mkdir -p "$p/a/b" u/v) 2> /dev/null && fail=1
 test -d "$p/a/b" || fail=1
 
index 5123730..b35ce19 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Ensure that mkdir -p works with arguments specified with a trailing "/.".
 
-# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 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,19 +21,7 @@ if test "$VERBOSE" = yes; then
   mkdir --version
 fi
 
-pwd=`pwd`
-tmp=`echo "$0"|sed 's,.*/,,'`.tmp
-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
-
-if test $framework_failure = 1; then
-  echo 'failure in testing framework'
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 fail=0
 
index c3c8499..8607a93 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Ensure that mkdir -p foo/bar works when foo is a symbolic link to a directory
 
-# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 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,23 +21,11 @@ if test "$VERBOSE" = yes; then
   mkdir --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 . slink || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+ln -s . slink || framework_failure
 
 fail=0
-
 mkdir -p slink/x || fail=1
 test -d x || fail=1
 
index 3ec9110..2c84b41 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Test mkdir -pv.
 
-# 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,27 +21,8 @@ if test "$VERBOSE" = yes; then
   mkdir --version
 fi
 
-# Make sure we get English translations.
-LANGUAGE=C
-export LANGUAGE
-LC_ALL=C
-export LC_ALL
-LANG=C
-export LANG
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && 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/../lang-default
+. $srcdir/../test-lib.sh
 
 mkdir -pv foo/a/b/c/d 2>out || exit
 
index 27e0d0a..8130274 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # make sure mkdir's -p options works properly
 
-# Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000, 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,28 +21,10 @@ if test "$VERBOSE" = yes; then
   mkdir --version
 fi
 
-pwd=`pwd`
-tmp=parents-$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
+. $srcdir/../test-lib.sh
+. "$abs_top_srcdir/tests/setgid-check"
 
-framework_failure=0
-
-# Record absolute path of srcdir.
-cd $srcdir || framework_failure=1
-abs_srcdir=`pwd`
-
-cd "$pwd" || framework_failure=1
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir -m 700 e-dir || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo 'failure in testing framework'
-  (exit 1); exit 1
-fi
-
-. "$abs_srcdir/../setgid-check"
+mkdir -m 700 e-dir || framework_failure
 
 fail=0
 
@@ -54,12 +36,12 @@ mkdir e-dir > /dev/null 2>&1 && fail=1
 # Create an existing directory.
 umask 077
 mode_str=drwxr-x-wx
-mode_arg=`"$abs_srcdir/../rwx-to-mode" $mode_str`
+mode_arg=`"$abs_top_srcdir/tests/rwx-to-mode" $mode_str`
 mkdir -m $mode_arg a || fail=1
 
 # this `mkdir -p ...' shouldn't change perms of existing dir `a'.
 d_mode_str=drwx-w--wx
-d_mode_arg=`"$abs_srcdir/../rwx-to-mode" $d_mode_str`
+d_mode_arg=`"$abs_top_srcdir/tests/rwx-to-mode" $d_mode_str`
 mkdir -p -m $d_mode_arg a/b/c/d
 
 # Make sure the permissions of `a' haven't been changed.
index e709930..a10d5f6 100755 (executable)
@@ -2,8 +2,7 @@
 # Verify that mkdir's `-m MODE' option works properly
 # with various umask settings.
 
-# Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006 Free Software
-# Foundation, Inc.
+# Copyright (C) 2000, 2002-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,28 +22,9 @@ if test "$VERBOSE" = yes; then
   mkdir --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
-
-framework_failure=0
-
-# Record absolute path of srcdir and cd back to current dir.
-cd $srcdir || framework_failure=1
-abs_srcdir=`pwd`
-cd "$pwd" || framework_failure=1
-
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo 'failure in testing framework'
-  (exit 1); exit 1
-fi
-
-. "$abs_srcdir/../setgid-check"
-. "$abs_srcdir/../umask-check"
+. $srcdir/../test-lib.sh
+. "$abs_top_srcdir/tests/setgid-check"
+. "$abs_top_srcdir/tests/umask-check"
 
 fail=0
 
index 842899f..f65d2ae 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # verify that mkdir honors special bits in MODE
 
-# Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000, 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,13 +21,12 @@ if test "$VERBOSE" = yes; then
   mkdir --version
 fi
 
-tmp=mkdir-sp-$$
-trap 'status=$?; rm -rf $tmp && exit $status' 0
-trap 'exit $?' 1 2 13 15
+. $srcdir/../test-lib.sh
 
 set_mode_string=u=rwx,g=rx,o=w,-s,+t
 output_mode_string=drwxr-x-wT
 
+tmp=t
 mkdir -m$set_mode_string $tmp || fail=1
 
 test -d $tmp || fail=1
index 289b3d1..a6fab5c 100755 (executable)
@@ -2,7 +2,7 @@
 # Ensure that mkdir works with arguments specified with and without
 # a trailing slash.
 
-# Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000, 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,19 +22,7 @@ if test "$VERBOSE" = yes; then
   mkdir --version
 fi
 
-pwd=`pwd`
-tmp=t-slash.$$
-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
-
-if test $framework_failure = 1; then
-  echo 'failure in testing framework'
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 fail=0