summaryrefslogtreecommitdiff
path: root/tests/dd
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-11-14 11:05:05 +0100
committerJim Meyering <meyering@redhat.com>2010-11-17 20:48:57 +0100
commitf38becab02472e6872048a1951b249b2a3c054df (patch)
treee5b531384b55abae8b1829ada892891bfee58fe3 /tests/dd
parent30b74dfff16240ea0e4a4c5b705f1e9631e5d0a7 (diff)
downloadcoreutils-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/dd')
-rwxr-xr-xtests/dd/direct8
-rwxr-xr-xtests/dd/misc8
-rwxr-xr-xtests/dd/not-rewound8
-rwxr-xr-xtests/dd/reblock8
-rwxr-xr-xtests/dd/skip-seek-past-dev8
-rwxr-xr-xtests/dd/skip-seek-past-file8
-rwxr-xr-xtests/dd/skip-seek28
-rwxr-xr-xtests/dd/stderr8
-rwxr-xr-xtests/dd/unblock-sync8
9 files changed, 18 insertions, 54 deletions
diff --git a/tests/dd/direct b/tests/dd/direct
index 46bf35f32..1381ce68c 100755
--- a/tests/dd/direct
+++ b/tests/dd/direct
@@ -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
- dd --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && dd --version
truncate -s 8192 in || framework_failure
dd if=in oflag=direct of=out 2> /dev/null \
diff --git a/tests/dd/misc b/tests/dd/misc
index ddd7bbd9e..92be45046 100755
--- a/tests/dd/misc
+++ b/tests/dd/misc
@@ -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
- dd --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && dd --version
tmp_in=dd-in.$$
tmp_in2=dd-in2.$$
diff --git a/tests/dd/not-rewound b/tests/dd/not-rewound
index 67c2971f4..75c08c952 100755
--- a/tests/dd/not-rewound
+++ b/tests/dd/not-rewound
@@ -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
- dd --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && dd --version
echo abcde > in
diff --git a/tests/dd/reblock b/tests/dd/reblock
index 9c9b0f85f..c5d667c8c 100755
--- a/tests/dd/reblock
+++ b/tests/dd/reblock
@@ -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
- dd --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && dd --version
# 2 short reads -> 1 full write + 1 partial write
cat <<\EOF > exp-reblock || framework_failure
diff --git a/tests/dd/skip-seek-past-dev b/tests/dd/skip-seek-past-dev
index 9e910e8ee..762671c27 100755
--- a/tests/dd/skip-seek-past-dev
+++ b/tests/dd/skip-seek-past-dev
@@ -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
- dd --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && dd --version
# need write access to local device
# (even though we don't actually write anything)
diff --git a/tests/dd/skip-seek-past-file b/tests/dd/skip-seek-past-file
index 9327f1ea5..605e964f7 100755
--- a/tests/dd/skip-seek-past-file
+++ b/tests/dd/skip-seek-past-file
@@ -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
- dd --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && dd --version
require_sparse_support_ # for `truncate --size=$OFF_T_MAX`
eval $(getlimits) # for OFF_T limits
diff --git a/tests/dd/skip-seek2 b/tests/dd/skip-seek2
index 7b60af62e..4897e10e1 100755
--- a/tests/dd/skip-seek2
+++ b/tests/dd/skip-seek2
@@ -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
- dd --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && dd --version
echo LA:3456789abcdef > in || fail=1
diff --git a/tests/dd/stderr b/tests/dd/stderr
index 5ef91e45e..fd7b7470d 100755
--- a/tests/dd/stderr
+++ b/tests/dd/stderr
@@ -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
- dd --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && dd --version
p=$abs_top_builddir
diff --git a/tests/dd/unblock-sync b/tests/dd/unblock-sync
index 7e45b7ee8..2d8dc328e 100755
--- a/tests/dd/unblock-sync
+++ b/tests/dd/unblock-sync
@@ -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
- dd --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && dd --version
printf 000100020003xx > in || framework_failure