diff options
author | Jim Meyering <meyering@redhat.com> | 2010-11-14 11:05:05 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-11-17 20:48:57 +0100 |
commit | f38becab02472e6872048a1951b249b2a3c054df (patch) | |
tree | e5b531384b55abae8b1829ada892891bfee58fe3 /tests/mkdir | |
parent | 30b74dfff16240ea0e4a4c5b705f1e9631e5d0a7 (diff) | |
download | coreutils-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/mkdir')
-rwxr-xr-x | tests/mkdir/p-1 | 8 | ||||
-rwxr-xr-x | tests/mkdir/p-2 | 8 | ||||
-rwxr-xr-x | tests/mkdir/p-3 | 8 | ||||
-rwxr-xr-x | tests/mkdir/p-slashdot | 8 | ||||
-rwxr-xr-x | tests/mkdir/p-thru-slink | 8 | ||||
-rwxr-xr-x | tests/mkdir/p-v | 8 | ||||
-rwxr-xr-x | tests/mkdir/parents | 8 | ||||
-rwxr-xr-x | tests/mkdir/perm | 8 | ||||
-rwxr-xr-x | tests/mkdir/special-1 | 8 | ||||
-rwxr-xr-x | tests/mkdir/t-slash | 8 | ||||
-rwxr-xr-x | tests/mkdir/writable-under-readonly | 8 |
11 files changed, 22 insertions, 66 deletions
diff --git a/tests/mkdir/p-1 b/tests/mkdir/p-1 index cd60d9f36..9c8e8a5d8 100755 --- a/tests/mkdir/p-1 +++ b/tests/mkdir/p-1 @@ -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 - mkdir --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mkdir --version mkdir --parents "`pwd`/t" || fail=1 test -d t || fail=1 diff --git a/tests/mkdir/p-2 b/tests/mkdir/p-2 index 863f188dc..735d7ad08 100755 --- a/tests/mkdir/p-2 +++ b/tests/mkdir/p-2 @@ -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 - mkdir --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mkdir --version mkdir --parents "`pwd`/t/u" || fail=1 test -d t/u || fail=1 diff --git a/tests/mkdir/p-3 b/tests/mkdir/p-3 index 116c794be..ddc812e0e 100755 --- a/tests/mkdir/p-3 +++ b/tests/mkdir/p-3 @@ -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 - mkdir --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mkdir --version skip_if_root_ mkdir no-access || framework_failure diff --git a/tests/mkdir/p-slashdot b/tests/mkdir/p-slashdot index 49843f1c0..fba112df2 100755 --- a/tests/mkdir/p-slashdot +++ b/tests/mkdir/p-slashdot @@ -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 - mkdir --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mkdir --version mkdir -p d1/. || fail=1 diff --git a/tests/mkdir/p-thru-slink b/tests/mkdir/p-thru-slink index 687c0ffed..e2cc9c93f 100755 --- a/tests/mkdir/p-thru-slink +++ b/tests/mkdir/p-thru-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 - mkdir --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mkdir --version ln -s . slink || framework_failure diff --git a/tests/mkdir/p-v b/tests/mkdir/p-v index 6118b492a..aeae33da9 100755 --- a/tests/mkdir/p-v +++ b/tests/mkdir/p-v @@ -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 - mkdir --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mkdir --version mkdir -pv foo/a/b/c/d >out || fail=1 diff --git a/tests/mkdir/parents b/tests/mkdir/parents index 405cc1942..951b6f9e0 100755 --- a/tests/mkdir/parents +++ b/tests/mkdir/parents @@ -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 - mkdir --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mkdir --version skip_if_setgid_ mkdir -m 700 e-dir || framework_failure diff --git a/tests/mkdir/perm b/tests/mkdir/perm index 7707e4f8d..0cd0a5581 100755 --- a/tests/mkdir/perm +++ b/tests/mkdir/perm @@ -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 - mkdir --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mkdir --version skip_if_setgid_ working_umask_or_skip_ diff --git a/tests/mkdir/special-1 b/tests/mkdir/special-1 index 93d203e77..7ed437021 100755 --- a/tests/mkdir/special-1 +++ b/tests/mkdir/special-1 @@ -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 - mkdir --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mkdir --version set_mode_string=u=rwx,g=rx,o=w,-s,+t output_mode_string=drwxr-x-wT diff --git a/tests/mkdir/t-slash b/tests/mkdir/t-slash index 053f98df3..ed72880c7 100755 --- a/tests/mkdir/t-slash +++ b/tests/mkdir/t-slash @@ -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 - mkdir --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mkdir --version mkdir -p dir/ || fail=1 diff --git a/tests/mkdir/writable-under-readonly b/tests/mkdir/writable-under-readonly index 18a44ae9a..2c8ac52f4 100755 --- a/tests/mkdir/writable-under-readonly +++ b/tests/mkdir/writable-under-readonly @@ -24,12 +24,8 @@ # # Demonstrate the problem, as root: -if test "$VERBOSE" = yes; then - set -x - mkdir --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && mkdir --version require_root_ # FIXME: for now, skip it unconditionally |