mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-27 13:17:56 +01:00
ec26eeaeec
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.
31 lines
845 B
Bash
31 lines
845 B
Bash
# Source this script to set and export NOTMUCH_SRCDIR and
|
|
# NOTMUCH_BUILDDIR.
|
|
#
|
|
# For this to work, always have current directory somewhere within the
|
|
# build directory hierarchy, and run the script sourcing this script
|
|
# using a path (relative or absolute) to the source directory.
|
|
|
|
if [[ -z "${NOTMUCH_SRCDIR}" ]]; then
|
|
export NOTMUCH_SRCDIR="$(cd "$(dirname "$0")"/.. && pwd)"
|
|
fi
|
|
|
|
find_builddir () {
|
|
local dir="$1"
|
|
|
|
while [[ -n "$dir" ]] && [[ "$dir" != "/" ]]; do
|
|
if [[ -x "$dir/notmuch" ]] && [[ ! -d "$dir/notmuch" ]]; then
|
|
echo "$dir"
|
|
break
|
|
fi
|
|
dir="$(dirname "$dir")"
|
|
done
|
|
}
|
|
|
|
if [[ -z "${NOTMUCH_BUILDDIR}" ]]; then
|
|
export NOTMUCH_BUILDDIR="$(find_builddir "$(pwd)")"
|
|
|
|
if [ -z "${NOTMUCH_BUILDDIR}" -a "${NOTMUCH_TEST_INSTALLED-0}" = "0" ]; then
|
|
echo "Run tests in a subdir of built notmuch tree." >&2
|
|
exit 1
|
|
fi
|
|
fi
|