#!/bin/sh

set -e -u

# copy tests, test data and cert fixtures
cp --verbose --archive tests/ certs/ "$AUTOPKGTEST_TMP"
cd "$AUTOPKGTEST_TMP"

# set up writable HOME and D-Bus session for gsettings
export HOME="$AUTOPKGTEST_TMP/home"
mkdir -p "$HOME"
eval $(dbus-launch --sh-syntax)

# disarm -e to ensure all tests are run even if some fail
set +e
RETVAL=0

for t in tests/check_cli_*.sh; do
	echo "$t:"
	GNOMINT_CLI=/usr/bin/gnomint-cli srcdir=tests /bin/sh "$t" 2>&1
	RETVAL=$((RETVAL + $?))
done

exit $RETVAL
