From f38becab02472e6872048a1951b249b2a3c054df Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 14 Nov 2010 11:05:05 +0100 Subject: 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," --- tests/install/basic-1 | 8 ++------ tests/install/create-leading | 8 ++------ tests/install/d-slashdot | 8 ++------ tests/install/install-C | 8 ++------ tests/install/install-C-root | 8 ++------ tests/install/install-C-selinux | 8 ++------ tests/install/strip-program | 8 ++------ tests/install/trap | 8 ++------ 8 files changed, 16 insertions(+), 48 deletions(-) (limited to 'tests/install') 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 . -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 . -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 . -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 . -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 . -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 . -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 . -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. -- cgit v1.2.3-70-g09d2