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/install | |
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/install')
-rwxr-xr-x | tests/install/basic-1 | 8 | ||||
-rwxr-xr-x | tests/install/create-leading | 8 | ||||
-rwxr-xr-x | tests/install/d-slashdot | 8 | ||||
-rwxr-xr-x | tests/install/install-C | 8 | ||||
-rwxr-xr-x | tests/install/install-C-root | 8 | ||||
-rwxr-xr-x | tests/install/install-C-selinux | 8 | ||||
-rwxr-xr-x | tests/install/strip-program | 8 | ||||
-rwxr-xr-x | tests/install/trap | 8 |
8 files changed, 16 insertions, 48 deletions
diff --git a/tests/install/basic-1 b/tests/install/basic-1 index 7ea103b28..6470f5dd3 100755 --- a/tests/install/basic-1 +++ b/tests/install/basic-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 - ginstall --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ginstall --version skip_if_root_ dir=dir diff --git a/tests/install/create-leading b/tests/install/create-leading index e342e23df..acb92a9a6 100755 --- a/tests/install/create-leading +++ b/tests/install/create-leading @@ -19,12 +19,8 @@ # Note that the tests below use `ginstall', not install, because # that's the name of the binary in ../../src. -if test "$VERBOSE" = yes; then - set -x - ginstall --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ginstall --version file=file diff --git a/tests/install/d-slashdot b/tests/install/d-slashdot index 960898c52..b7cd17a22 100755 --- a/tests/install/d-slashdot +++ b/tests/install/d-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 - install --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && install --version ginstall -d d1/. || fail=1 diff --git a/tests/install/install-C b/tests/install/install-C index 681a60e9a..ea6292c79 100755 --- a/tests/install/install-C +++ b/tests/install/install-C @@ -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 - ginstall --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ginstall --version skip_if_setgid_ mode1=0644 diff --git a/tests/install/install-C-root b/tests/install/install-C-root index 29ff2503c..a36aa1efe 100755 --- a/tests/install/install-C-root +++ b/tests/install/install-C-root @@ -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 - ginstall --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ginstall --version require_root_ skip_if_setgid_ diff --git a/tests/install/install-C-selinux b/tests/install/install-C-selinux index fe8e5a61b..8818c7359 100755 --- a/tests/install/install-C-selinux +++ b/tests/install/install-C-selinux @@ -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 - ginstall --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ginstall --version require_selinux_ diff --git a/tests/install/strip-program b/tests/install/strip-program index abe4b5fb0..71001d9d9 100755 --- a/tests/install/strip-program +++ b/tests/install/strip-program @@ -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 - ginstall --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ginstall --version working_umask_or_skip_ diff --git a/tests/install/trap b/tests/install/trap index d71bd4a01..3092e9249 100755 --- a/tests/install/trap +++ b/tests/install/trap @@ -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 - ginstall --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && ginstall --version # Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh. |