#!/bin/sh

set -e

# we need the buildin webserver for the tests
if [ ! -e environment.mak ]; then
    make startup
fi
make -C test/interactive-helper/

# run tests against the installed apt, use "env -i" to ensure
# the host env does not pollute our environment
env -i \
APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR=$(pwd)/build/bin \
APT_INTEGRATION_TESTS_METHODS_DIR=/usr/lib/apt/methods \
APT_INTEGRATION_TESTS_LIBEXEC_DIR=/usr/lib/apt/ \
APT_INTEGRATION_TESTS_INTERNAL_SOLVER=/usr/lib/apt/solvers/apt \
APT_INTEGRATION_TESTS_BUILD_DIR=/usr/bin \
APT_INTEGRATION_TESTS_LIBRARY_PATH=/dev/null/does/not/exist \
./test/integration/run-tests