summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-07-08 13:15:02 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-07-08 13:15:02 -0700
commit62473695d2e3ef9c07b71d8decce92bc6cd5c469 (patch)
tree2dcc6dd680106440d085e092c93961b1fc041229
parentMerge branch 'jx/sideband-cleanup' (diff)
parentt: use portable wrapper for readlink(1) (diff)
downloadtgif-62473695d2e3ef9c07b71d8decce92bc6cd5c469.tar.xz
Merge branch 'jk/test-without-readlink-1'
Some test scripts assumed that readlink(1) was universally installed and available, which is not the case. * jk/test-without-readlink-1: t: use portable wrapper for readlink(1)
-rwxr-xr-xt/t3210-pack-refs.sh2
-rwxr-xr-xt/t9802-git-p4-filetype.sh4
-rw-r--r--t/test-lib-functions.sh6
3 files changed, 9 insertions, 3 deletions
diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index 3b7cdc56ec..577f32dc71 100755
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
@@ -253,7 +253,7 @@ test_expect_success SYMLINKS 'pack symlinked packed-refs' '
git for-each-ref >all-refs-packed &&
test_cmp all-refs-before all-refs-packed &&
test -h .git/packed-refs &&
- test "$(readlink .git/packed-refs)" = "my-deviant-packed-refs"
+ test "$(test_readlink .git/packed-refs)" = "my-deviant-packed-refs"
'
test_done
diff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh
index 94edebe272..19073c6e9f 100755
--- a/t/t9802-git-p4-filetype.sh
+++ b/t/t9802-git-p4-filetype.sh
@@ -263,7 +263,7 @@ test_expect_success SYMLINKS 'ensure p4 symlink parsed correctly' '
(
cd "$git" &&
test -L symlink &&
- test $(readlink symlink) = symlink-target
+ test $(test_readlink symlink) = symlink-target
)
'
@@ -329,7 +329,7 @@ test_expect_success SYMLINKS 'empty symlink target' '
git p4 clone --dest="$git" //depot@all &&
(
cd "$git" &&
- test $(readlink empty-symlink) = target2
+ test $(test_readlink empty-symlink) = target2
)
'
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index f0448daa74..b2810478a2 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1708,3 +1708,9 @@ test_region () {
return 0
}
+
+# Print the destination of symlink(s) provided as arguments. Basically
+# the same as the readlink command, but it's not available everywhere.
+test_readlink () {
+ perl -le 'print readlink($_) for @ARGV' "$@"
+}