#!/usr/bin/make -f
#export DH_VERBOSE = 1

# tests usually take just under an hour
# repro build servers can take longer
# use 3h instead of the default 25m
TEST_ARGS = --timeout 10800

# ctest normally suppresses test output
# https://cmake.org/cmake/help/latest/manual/ctest.1.html#options
# debhelper 13.5 enables ctest output when build is not terse
# reimplement this when debhelper is too old to support this
ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
DEBHELPER_VERSION = $(strip $(shell dpkg-query -f '$${Version}' -W debhelper))
DEBHELPER_OK = $(strip $(shell dpkg --compare-versions $(DEBHELPER_VERSION) ge 13.5~; echo $$?))
ifneq ($(DEBHELPER_OK),0)
	TEST_ARGS += --verbose
endif
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic

%:
	dh $@

override_dh_auto_test:
	dh_auto_test -- ARGS+="$(TEST_ARGS)"
