aboutsummaryrefslogtreecommitdiffstats
path: root/tests/run
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2022-02-23 00:35:41 +0100
committerGuilhem Moulin <guilhem@fripost.org>2022-02-23 21:23:55 +0100
commiteeed44617b8b2bf4c941f6de334a9006804615fb (patch)
treee91570238753a4168e07c99f84fa4f7017e1f981 /tests/run
parenta7bae9d4eb282fe805834b8f4185a019fc9bb246 (diff)
Don't assume Net::IMAP::InterIMAP is always in @INC.
And make the installation path configurable at `make` time. Moreover, adjust the 'test' target so the site directory and interimap/pullimap path are configurable with INTERIMAP_I and INTERIMAP_PATH respectively. That way one can run `tests/run foo` to check the source, `make test` to check what's been built, and we also have the possibility to check the installed program e.g. for autopkgtests.
Diffstat (limited to 'tests/run')
-rwxr-xr-xtests/run15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/run b/tests/run
index 1eaad54..230ca83 100755
--- a/tests/run
+++ b/tests/run
@@ -38,6 +38,12 @@ fi
# cleanup environment
unset OPENSSL_CONF SSL_CERT_FILE SSL_CERT_DIR
+if [ -z "${INTERIMAP_PATH+x}" ]; then
+ INTERIMAP_PATH="./"
+elif [ -n "$INTERIMAP_PATH" ]; then
+ INTERIMAP_PATH="${INTERIMAP_PATH%/}/"
+fi
+
ROOTDIR="$(mktemp --tmpdir="${TMPDIR:-/dev/shm}" --directory "$1.XXXXXXXXXX")"
declare -a DOVECOT_SERVER=()
trap cleanup EXIT INT TERM
@@ -206,14 +212,17 @@ prepare
interimap() { _interimap_cmd "interimap" "$@"; }
pullimap() { _interimap_cmd "pullimap" "$@"; }
_interimap_cmd() {
- declare -a ENVIRON=()
+ declare -a ENVIRON=() args=()
local script="$1" rv=0
shift
environ_set "local"
[ -z "${OPENSSL_CONF+x}" ] || ENVIRON+=( OPENSSL_CONF="$OPENSSL_CONF" )
[ -z "${SSL_CERT_FILE+x}" ] || ENVIRON+=( SSL_CERT_FILE="$SSL_CERT_FILE" )
[ -z "${SSL_CERT_DIR+x}" ] || ENVIRON+=( SSL_CERT_DIR="$SSL_CERT_DIR" )
- env -i "${ENVIRON[@]}" perl -I./lib -T "./$script" "$@" 2>"$STDERR" || rv=$?
+ [ -z "${INTERIMAP_I:+x}" ] || args+=( perl -I"$INTERIMAP_I" -T )
+ args+=( "$INTERIMAP_PATH$script" "$@" )
+ #printf "I: Running \`%s\`\\n" "${args[*]}" >&3
+ env -i "${ENVIRON[@]}" "${args[@]}" 2>"$STDERR" || rv=$?
cat <"$STDERR" >&2
return $rv
}
@@ -449,7 +458,7 @@ passed() {
# Run test in a sub-shell
declare -a ENVIRON=()
environ_set "local"
-export TMPDIR TESTDIR STDERR "${ENVIRON[@]}"
+export TMPDIR TESTDIR INTERIMAP_PATH INTERIMAP_I STDERR "${ENVIRON[@]}"
export -f environ_set doveadm interimap interimap_init pullimap _interimap_cmd
export -f sqlite3 sample_message deliver ptree_abort step_start step_done passed
export -f check_mailbox_status check_mailbox_status_values check_mailbox_status2