#!/bin/bash

set -e

# Cassandane ships inside the Cyrus source tree; the standalone
# https://github.com/cyrusimap/cassandane repository is archived and
# defunct (last commit 2021-11-22).  Point the runner at our own copy so
# that the tests actually match the version under test -- in particular
# the regression tests that come with the security fixes.
export CASSANDANESRC="$(pwd)/cassandane"

# Historically only Cyrus::ImapTest was run, which left the ACL, URLAUTH,
# delete and MIME parsing code paths -- i.e. everything hardened by
# CVE-2026-47081 .. CVE-2026-47089 -- untested.  Override CASSANDANEOPTS
# to run a different set, or leave it empty to run the whole suite.
export CASSANDANEOPTS="${CASSANDANEOPTS-Cyrus::ImapTest Cyrus::ACL Cyrus::Delete Cyrus::MIME Cyrus::Search Cyrus::URLAuth Cyrus::XApplePushService}"

export BUILD_CYRUS_FROM_SOURCE="no"

cd debian/tests/no-docker

sh ./install-env.sh || exit 77
./run.sh
