summaryrefslogtreecommitdiff
path: root/tests/cp
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/cp
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/cp')
-rwxr-xr-xtests/cp/abuse8
-rwxr-xr-xtests/cp/backup-18
-rwxr-xr-xtests/cp/backup-dir8
-rwxr-xr-xtests/cp/backup-is-src8
-rwxr-xr-xtests/cp/capability8
-rwxr-xr-xtests/cp/cp-HL8
-rwxr-xr-xtests/cp/cp-a-selinux8
-rwxr-xr-xtests/cp/cp-deref8
-rwxr-xr-xtests/cp/cp-i8
-rwxr-xr-xtests/cp/cp-parents8
-rwxr-xr-xtests/cp/deref-slink8
-rwxr-xr-xtests/cp/dir-rm-dest8
-rwxr-xr-xtests/cp/dir-slash8
-rwxr-xr-xtests/cp/dir-vs-file8
-rwxr-xr-xtests/cp/existing-perm-race8
-rwxr-xr-xtests/cp/fail-perm8
-rwxr-xr-xtests/cp/file-perm-race8
-rwxr-xr-xtests/cp/into-self8
-rwxr-xr-xtests/cp/link8
-rwxr-xr-xtests/cp/link-heap8
-rwxr-xr-xtests/cp/link-no-deref8
-rwxr-xr-xtests/cp/link-preserve8
-rwxr-xr-xtests/cp/no-deref-link18
-rwxr-xr-xtests/cp/no-deref-link28
-rwxr-xr-xtests/cp/no-deref-link38
-rwxr-xr-xtests/cp/parent-perm8
-rwxr-xr-xtests/cp/parent-perm-race8
-rwxr-xr-xtests/cp/preserve-28
-rwxr-xr-xtests/cp/preserve-slink-time8
-rwxr-xr-xtests/cp/proc-short-read8
-rwxr-xr-xtests/cp/proc-zero-len8
-rwxr-xr-xtests/cp/r-vs-symlink8
-rwxr-xr-xtests/cp/reflink-auto8
-rwxr-xr-xtests/cp/reflink-perm8
-rwxr-xr-xtests/cp/same-file8
-rwxr-xr-xtests/cp/slink-2-slink8
-rwxr-xr-xtests/cp/sparse8
-rwxr-xr-xtests/cp/special-bits8
-rwxr-xr-xtests/cp/special-f8
-rwxr-xr-xtests/cp/src-base-dot8
-rwxr-xr-xtests/cp/symlink-slash8
-rwxr-xr-xtests/cp/thru-dangling8
42 files changed, 84 insertions, 252 deletions
diff --git a/tests/cp/abuse b/tests/cp/abuse
index 2979f0d99..fb5e4358c 100755
--- a/tests/cp/abuse
+++ b/tests/cp/abuse
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkdir a b c || framework_failure
ln -s ../t a/1 || framework_failure
diff --git a/tests/cp/backup-1 b/tests/cp/backup-1
index fc7202857..690846214 100755
--- a/tests/cp/backup-1
+++ b/tests/cp/backup-1
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
suffix=.b
file=b1.$$
diff --git a/tests/cp/backup-dir b/tests/cp/backup-dir
index 436812319..c1718dedc 100755
--- a/tests/cp/backup-dir
+++ b/tests/cp/backup-dir
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkdir x y || framework_failure
diff --git a/tests/cp/backup-is-src b/tests/cp/backup-is-src
index 5944eb9b7..8a8b48069 100755
--- a/tests/cp/backup-is-src
+++ b/tests/cp/backup-is-src
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
echo a > a || framework_failure
echo a-tilde > a~ || framework_failure
diff --git a/tests/cp/capability b/tests/cp/capability
index f4ee227f5..3a241d058 100755
--- a/tests/cp/capability
+++ b/tests/cp/capability
@@ -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
- ls --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && ls --version
require_root_
working_umask_or_skip_
diff --git a/tests/cp/cp-HL b/tests/cp/cp-HL
index 6407fb7dc..f2a2dc438 100755
--- a/tests/cp/cp-HL
+++ b/tests/cp/cp-HL
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkdir src-dir dest-dir || framework_failure
echo f > f || framework_failure
diff --git a/tests/cp/cp-a-selinux b/tests/cp/cp-a-selinux
index cff87311f..bfc79562d 100755
--- a/tests/cp/cp-a-selinux
+++ b/tests/cp/cp-a-selinux
@@ -19,12 +19,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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
require_root_
require_selinux_
diff --git a/tests/cp/cp-deref b/tests/cp/cp-deref
index 50efdd3b5..8315a6254 100755
--- a/tests/cp/cp-deref
+++ b/tests/cp/cp-deref
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkdir a b c d || framework_failure
ln -s ../c a || framework_failure
diff --git a/tests/cp/cp-i b/tests/cp/cp-i
index f5cba16e1..8e86267fa 100755
--- a/tests/cp/cp-i
+++ b/tests/cp/cp-i
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkdir -p a b/a/c || framework_failure
touch a/c || framework_failure
diff --git a/tests/cp/cp-parents b/tests/cp/cp-parents
index c77a32857..22100b502 100755
--- a/tests/cp/cp-parents
+++ b/tests/cp/cp-parents
@@ -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
- mv --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && mv --version
working_umask_or_skip_
diff --git a/tests/cp/deref-slink b/tests/cp/deref-slink
index de2e5e631..a11bd0dc9 100755
--- a/tests/cp/deref-slink
+++ b/tests/cp/deref-slink
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
touch f slink-target || framework_failure
ln -s slink-target slink || framework_failure
diff --git a/tests/cp/dir-rm-dest b/tests/cp/dir-rm-dest
index 523edbdc1..2923a474e 100755
--- a/tests/cp/dir-rm-dest
+++ b/tests/cp/dir-rm-dest
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkdir d e || framework_failure
diff --git a/tests/cp/dir-slash b/tests/cp/dir-slash
index 76b14b6e7..18050a3af 100755
--- a/tests/cp/dir-slash
+++ b/tests/cp/dir-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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkdir dir1 dir2 || framework_failure
touch dir1/file || framework_failure
diff --git a/tests/cp/dir-vs-file b/tests/cp/dir-vs-file
index 32530a613..499014184 100755
--- a/tests/cp/dir-vs-file
+++ b/tests/cp/dir-vs-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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkdir dir || framework_failure
touch file || framework_failure
diff --git a/tests/cp/existing-perm-race b/tests/cp/existing-perm-race
index ffd29f0f4..f1c7bc1ad 100755
--- a/tests/cp/existing-perm-race
+++ b/tests/cp/existing-perm-race
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
require_membership_in_two_groups_
diff --git a/tests/cp/fail-perm b/tests/cp/fail-perm
index 656b16e23..cd763f7da 100755
--- a/tests/cp/fail-perm
+++ b/tests/cp/fail-perm
@@ -15,12 +15,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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
skip_if_root_
chmod g-s . || framework_failure
diff --git a/tests/cp/file-perm-race b/tests/cp/file-perm-race
index d80761259..6b3b60450 100755
--- a/tests/cp/file-perm-race
+++ b/tests/cp/file-perm-race
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
# cp -p gives ENOTSUP on NFS on Linux 2.6.9 at least
require_local_dir_
diff --git a/tests/cp/into-self b/tests/cp/into-self
index 21aae8076..3341d1a8b 100755
--- a/tests/cp/into-self
+++ b/tests/cp/into-self
@@ -21,12 +21,8 @@
# Now it gives this:
# cp: can't copy a directory `dir' into itself `dir/dir'
-if test "$VERBOSE" = yes; then
- set -x
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkdir a dir || framework_failure
diff --git a/tests/cp/link b/tests/cp/link
index 9935465d4..f0bd241f9 100755
--- a/tests/cp/link
+++ b/tests/cp/link
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
touch src || framework_failure
touch dest || framework_failure
diff --git a/tests/cp/link-heap b/tests/cp/link-heap
index fe2f6b1aa..f5ed6e60e 100755
--- a/tests/cp/link-heap
+++ b/tests/cp/link-heap
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
expensive_
require_ulimit_
diff --git a/tests/cp/link-no-deref b/tests/cp/link-no-deref
index 86f05fd5d..d575ec851 100755
--- a/tests/cp/link-no-deref
+++ b/tests/cp/link-no-deref
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
ln -s no-such-file dangling-slink || framework_failure
diff --git a/tests/cp/link-preserve b/tests/cp/link-preserve
index 9eb95ad5e..fe5ad42c9 100755
--- a/tests/cp/link-preserve
+++ b/tests/cp/link-preserve
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
touch a || framework_failure
ln a b || framework_failure
diff --git a/tests/cp/no-deref-link1 b/tests/cp/no-deref-link1
index 411692842..f0d1a9e9b 100755
--- a/tests/cp/no-deref-link1
+++ b/tests/cp/no-deref-link1
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkdir a b
msg=bar
diff --git a/tests/cp/no-deref-link2 b/tests/cp/no-deref-link2
index aa0d8ab3b..2351589a7 100755
--- a/tests/cp/no-deref-link2
+++ b/tests/cp/no-deref-link2
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkdir b
msg=bar
diff --git a/tests/cp/no-deref-link3 b/tests/cp/no-deref-link3
index c3c7d89ac..1053b3ef7 100755
--- a/tests/cp/no-deref-link3
+++ b/tests/cp/no-deref-link3
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
msg=bar
echo $msg > a
diff --git a/tests/cp/parent-perm b/tests/cp/parent-perm
index 4a7d98947..82dd913ac 100755
--- a/tests/cp/parent-perm
+++ b/tests/cp/parent-perm
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
working_umask_or_skip_
# cp -p gives ENOTSUP on NFS on Linux 2.6.9 at least
diff --git a/tests/cp/parent-perm-race b/tests/cp/parent-perm-race
index e595d9ea8..b6374aecd 100755
--- a/tests/cp/parent-perm-race
+++ b/tests/cp/parent-perm-race
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
# cp -p gives ENOTSUP on NFS on Linux 2.6.9 at least
require_local_dir_
diff --git a/tests/cp/preserve-2 b/tests/cp/preserve-2
index 9863952c2..d7565df3b 100755
--- a/tests/cp/preserve-2
+++ b/tests/cp/preserve-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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
# cp -p gives ENOTSUP on NFS on Linux 2.6.9 at least
require_local_dir_
diff --git a/tests/cp/preserve-slink-time b/tests/cp/preserve-slink-time
index 88c1016f8..5a61b7e8c 100755
--- a/tests/cp/preserve-slink-time
+++ b/tests/cp/preserve-slink-time
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
grep '^#define HAVE_UTIMENSAT 1' "$CONFIG_HEADER" > /dev/null ||
grep '^#define HAVE_LUTIMES 1' "$CONFIG_HEADER" > /dev/null ||
diff --git a/tests/cp/proc-short-read b/tests/cp/proc-short-read
index afe08491b..2bc2a6195 100755
--- a/tests/cp/proc-short-read
+++ b/tests/cp/proc-short-read
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
kall=/proc/kallsyms
diff --git a/tests/cp/proc-zero-len b/tests/cp/proc-zero-len
index 9cc81bc14..ca28fa428 100755
--- a/tests/cp/proc-zero-len
+++ b/tests/cp/proc-zero-len
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
touch empty || framework_failure
diff --git a/tests/cp/r-vs-symlink b/tests/cp/r-vs-symlink
index e537767b9..7d9dfd8e4 100755
--- a/tests/cp/r-vs-symlink
+++ b/tests/cp/r-vs-symlink
@@ -20,12 +20,8 @@
# though now such usage evokes a warning:
# cp: `slink': WARNING: using -r to copy symbolic links is not portable
-if test "$VERBOSE" = yes; then
- set -x
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
echo abc > foo || framework_failure
ln -s foo slink || framework_failure
diff --git a/tests/cp/reflink-auto b/tests/cp/reflink-auto
index 9d60940bb..7d61ed25b 100755
--- a/tests/cp/reflink-auto
+++ b/tests/cp/reflink-auto
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
cleanup_() { rm -rf "$other_partition_tmpdir"; }
. "$abs_srcdir/other-fs-tmpdir"
diff --git a/tests/cp/reflink-perm b/tests/cp/reflink-perm
index e1c12aa5a..a330584c1 100755
--- a/tests/cp/reflink-perm
+++ b/tests/cp/reflink-perm
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
: > time_check
diff --git a/tests/cp/same-file b/tests/cp/same-file
index bcb2a9d0d..97b5b2909 100755
--- a/tests/cp/same-file
+++ b/tests/cp/same-file
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
# Unset CDPATH. Otherwise, output from the `cd dir' command
# can make this test fail.
diff --git a/tests/cp/slink-2-slink b/tests/cp/slink-2-slink
index bdfb9a90b..69e0c9511 100755
--- a/tests/cp/slink-2-slink
+++ b/tests/cp/slink-2-slink
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
touch file || framework_failure
ln -s file a || framework_failure
diff --git a/tests/cp/sparse b/tests/cp/sparse
index 73c292476..60e226b27 100755
--- a/tests/cp/sparse
+++ b/tests/cp/sparse
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
require_sparse_support_
# Create a sparse file.
diff --git a/tests/cp/special-bits b/tests/cp/special-bits
index 6f32847bc..f09e499fc 100755
--- a/tests/cp/special-bits
+++ b/tests/cp/special-bits
@@ -20,12 +20,8 @@
# This test would fail due to a bug introduced in 4.0y.
# The bug was fixed in 4.0z.
-if test "$VERBOSE" = yes; then
- set -x
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
require_root_
touch a b c || framework_failure
diff --git a/tests/cp/special-f b/tests/cp/special-f
index 22872e733..6c0b13734 100755
--- a/tests/cp/special-f
+++ b/tests/cp/special-f
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkfifo fifo ||
skip_test_ "fifos not supported"
diff --git a/tests/cp/src-base-dot b/tests/cp/src-base-dot
index 8e38ae68a..73e4f6ff7 100755
--- a/tests/cp/src-base-dot
+++ b/tests/cp/src-base-dot
@@ -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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkdir x y || framework_failure
diff --git a/tests/cp/symlink-slash b/tests/cp/symlink-slash
index ac63ba2b1..dfc9b2bf0 100755
--- a/tests/cp/symlink-slash
+++ b/tests/cp/symlink-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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
mkdir dir || framework_failure
ln -s dir symlink || framework_failure
diff --git a/tests/cp/thru-dangling b/tests/cp/thru-dangling
index 729eb5e6f..592dda2a5 100755
--- a/tests/cp/thru-dangling
+++ b/tests/cp/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
- cp --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && cp --version
ln -s no-such dangle || framework_failure
echo hi > f || framework_failure