aboutsummaryrefslogtreecommitdiff
path: root/test/test-lib.sh
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2023-04-09 11:26:26 -0300
committerDavid Bremner <david@tethera.net>2023-07-21 07:41:50 -0300
commitec26eeaeec87781dee7dbf720103a5bc9b6bba5d (patch)
tree421ad3947e7c06066663f3e53a3c41af5605057f /test/test-lib.sh
parent73f3081160fb80345f3953cbdeba340975375325 (diff)
test: support testing notmuch as installed
We put some effort into testing the built copy rather than some installed copy. On the other hand for people like packagers, testing the installed copy is also of interest. When NOTMUCH_TEST_INSTALLED is set to a nonempty value, tests do not require a built notmuch tree or running configure. Some of the tests marked as broken when running against installed notmuch are probably fixable.
Diffstat (limited to 'test/test-lib.sh')
-rw-r--r--test/test-lib.sh27
1 files changed, 21 insertions, 6 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh
index f218fa03..059e110c 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -29,8 +29,8 @@ shopt -u xpg_echo
# Ensure NOTMUCH_SRCDIR and NOTMUCH_BUILDDIR are set.
. $(dirname "$0")/export-dirs.sh || exit 1
-# It appears that people try to run tests without building...
-if [[ ! -x "$NOTMUCH_BUILDDIR/notmuch" ]]; then
+# We need either a built tree, or a promise of an installed notmuch
+if [ -z "${NOTMUCH_TEST_INSTALLED-}" -a ! -x "$NOTMUCH_BUILDDIR/notmuch" ]; then
echo >&2 'You do not seem to have built notmuch yet.'
exit 1
fi
@@ -748,6 +748,12 @@ test_subtest_known_broken () {
test_subtest_known_broken_=t
}
+test_subtest_broken_for_installed () {
+ if [ -n "${NOTMUCH_TEST_INSTALLED-}" ]; then
+ test_subtest_known_broken_=t
+ fi
+}
+
test_subtest_broken_for_root () {
if [ "$EUID" = "0" ]; then
test_subtest_known_broken_=t
@@ -929,11 +935,16 @@ make_shim () {
}
notmuch_with_shim () {
- local base_name shim_file
- base_name="$1"
+ local base_name shim_file notmuch_cmd
+ if [ -n "${NOTMUCH_TEST_INSTALLED-}" ]; then
+ notmuch_cmd="notmuch"
+ else
+ notmuch_cmd="notmuch-shared"
+ fi
+ base_name=$1
shift
shim_file="${base_name}.so"
- LD_PRELOAD=${LD_PRELOAD:+:$LD_PRELOAD}:./${shim_file} notmuch-shared "$@"
+ LD_PRELOAD=${LD_PRELOAD:+:$LD_PRELOAD}:./${shim_file} $notmuch_cmd "$@"
}
# Creates a script that counts how much time it is executed and calls
@@ -985,7 +996,11 @@ test_init_ () {
# Where to run the tests
-TEST_DIRECTORY=$NOTMUCH_BUILDDIR/test
+if [[ -n "${NOTMUCH_BUILDDIR}" ]]; then
+ TEST_DIRECTORY=$NOTMUCH_BUILDDIR/test
+else
+ TEST_DIRECTORY=$NOTMUCH_SRCDIR/test
+fi
. "$NOTMUCH_SRCDIR/test/test-lib-common.sh" || exit 1