#! /usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

progname=$(shell awk '/^Source/ {print $$2}' debian/control)
buildroot=debian/$(progname)

deproot=$(progname)/deproot
tmp=debian/tmp

%:
	if ! mount | grep -q /proc; then \
		echo "### ERROR: /proc must be mounted"; \
		exit 1; \
	fi
	dh $@

override_dh_auto_test:
	set -eu; \
	TKLBAM_REGISTRY=$$(mktemp -d); \
	trap 'rm -rf "$$TKLBAM_REGISTRY"' EXIT; \
	export TKLBAM_REGISTRY PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=lib; \
	for test in profile_hooks restore_identity plan_limit connection profile_defer port_formats; do \
		python3 "tests/$$test.py" -v; \
	done; \
	python3 tests/database_backup.py ProcessBoundaryTest.test_mariadb_sandbox_preamble_preserves_first_database -v
