aboutsummaryrefslogtreecommitdiff
path: root/tests/test_scripts.sh
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2024-02-17 15:35:35 +0200
committerLasse Collin <lasse.collin@tukaani.org>2024-02-19 12:21:37 +0200
commit74e8bc7417a0f37ca7ed5ee0127d33c69b3100b9 (patch)
tree3204107c7e8c43f2c5c2a0597aa812af8d89a71c /tests/test_scripts.sh
parentCMake: Install scripts. (diff)
downloadxz-74e8bc7417a0f37ca7ed5ee0127d33c69b3100b9.tar.xz
CMake: Add test_scripts.sh to the tests.
In contrast to Automake, skipping of this test when decoders are disabled is handled at CMake side instead of test_scripts.sh because CMake-build doesn't create config.h.
Diffstat (limited to 'tests/test_scripts.sh')
-rwxr-xr-xtests/test_scripts.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/test_scripts.sh b/tests/test_scripts.sh
index 9b938466..ca9600ec 100755
--- a/tests/test_scripts.sh
+++ b/tests/test_scripts.sh
@@ -8,9 +8,11 @@
###############################################################################
# If scripts weren't built, this test is skipped.
-XZ=../src/xz/xz
-XZDIFF=../src/scripts/xzdiff
-XZGREP=../src/scripts/xzgrep
+# When this is run from CMake, $1 is a relative path
+# to the directory with the executables and the scripts.
+XZ=${1:-../src/xz}/xz
+XZDIFF=${1:-../src/scripts}/xzdiff
+XZGREP=${1:-../src/scripts}/xzgrep
for i in XZ XZDIFF XZGREP; do
eval test -x "\$$i" && continue
@@ -21,14 +23,15 @@ done
# Installing the scripts in this case is a bit silly but they
# could still be used with other decompression tools so configure
# doesn't automatically disable scripts if decoders are disabled.
-if grep 'define HAVE_DECODERS' ../config.h > /dev/null ; then
+if test ! -f ../config.h \
+ || grep 'define HAVE_DECODERS' ../config.h > /dev/null ; then
:
else
echo "Decompression support is disabled, skipping this test."
exit 77
fi
-PATH=`pwd`/../src/xz:$PATH
+PATH=`pwd`/${1:-../src/xz}:$PATH
export PATH
test -z "$srcdir" && srcdir=.