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/chmod | |
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/chmod')
-rwxr-xr-x | tests/chmod/c-option | 8 | ||||
-rwxr-xr-x | tests/chmod/equal-x | 8 | ||||
-rwxr-xr-x | tests/chmod/equals | 8 | ||||
-rwxr-xr-x | tests/chmod/inaccessible | 8 | ||||
-rwxr-xr-x | tests/chmod/no-x | 8 | ||||
-rwxr-xr-x | tests/chmod/octal | 8 | ||||
-rwxr-xr-x | tests/chmod/setgid | 8 | ||||
-rwxr-xr-x | tests/chmod/thru-dangling | 8 | ||||
-rwxr-xr-x | tests/chmod/umask-x | 8 | ||||
-rwxr-xr-x | tests/chmod/usage | 8 |
10 files changed, 20 insertions, 60 deletions
diff --git a/tests/chmod/c-option b/tests/chmod/c-option index c8b8ac8d1..4db905fc6 100755 --- a/tests/chmod/c-option +++ b/tests/chmod/c-option @@ -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 - chmod --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chmod --version umask 0 file=f diff --git a/tests/chmod/equal-x b/tests/chmod/equal-x index cd1358a00..32226f1ff 100755 --- a/tests/chmod/equal-x +++ b/tests/chmod/equal-x @@ -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 - chmod --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chmod --version file=f touch $file || framework_failure diff --git a/tests/chmod/equals b/tests/chmod/equals index 79f39f46b..79e01fb04 100755 --- a/tests/chmod/equals +++ b/tests/chmod/equals @@ -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 - chmod --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chmod --version touch f || framework_failure diff --git a/tests/chmod/inaccessible b/tests/chmod/inaccessible index 6127ad537..37dc8ffac 100755 --- a/tests/chmod/inaccessible +++ b/tests/chmod/inaccessible @@ -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 - chmod --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chmod --version mkdir -p d/e || framework_failure chmod 0 d/e d || framework_failure diff --git a/tests/chmod/no-x b/tests/chmod/no-x index f4e10826d..464a2544a 100755 --- a/tests/chmod/no-x +++ b/tests/chmod/no-x @@ -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 - chmod --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chmod --version skip_if_root_ mkdir -p d/no-x/y a/b || framework_failure diff --git a/tests/chmod/octal b/tests/chmod/octal index 695dbbd38..add57775b 100755 --- a/tests/chmod/octal +++ b/tests/chmod/octal @@ -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 - chmod --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chmod --version # Before coreutils-5.92, this would mistakenly succeed, diff --git a/tests/chmod/setgid b/tests/chmod/setgid index 01a320db9..89e971c5f 100755 --- a/tests/chmod/setgid +++ b/tests/chmod/setgid @@ -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 - chmod --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chmod --version umask 0 mkdir d || framework_failure diff --git a/tests/chmod/thru-dangling b/tests/chmod/thru-dangling index 478db701a..8421a989c 100755 --- a/tests/chmod/thru-dangling +++ b/tests/chmod/thru-dangling @@ -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 - chmod --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chmod --version ln -s non-existent dangle || framework_failure diff --git a/tests/chmod/umask-x b/tests/chmod/umask-x index da1cf1525..e0c5e36a9 100755 --- a/tests/chmod/umask-x +++ b/tests/chmod/umask-x @@ -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 - chmod --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chmod --version touch file chmod 755 file diff --git a/tests/chmod/usage b/tests/chmod/usage index 0aa1e18fc..e2d33fc32 100755 --- a/tests/chmod/usage +++ b/tests/chmod/usage @@ -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 - chmod --version -fi - -. $srcdir/test-lib.sh +. "${srcdir=.}/init.sh"; path_prepend_ ../src +test "$VERBOSE" = yes && chmod --version # Each line in this list is a set of arguments, followed by :, |