#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

D = debian/golang-pgregory-rapid-dev
M = $(D)/usr/share/gocode/src/pgregory.net/rapid

# XXX: Some tests fail hard when asynctimerchan!=0 which is the default when
# GO111MODULE is set to off.
export GODEBUG = asynctimerchan=0

%:
	dh $@ --builddirectory=debian/_build

# Remove indeterministic test data created during the test suite run.
execute_after_dh_auto_install:
	rm -f $(M)/vis-test.html
	rm -f $(M)/testdata/rapid/TestCheckCleanupPanic/*.fail
	if [ -d $(M)/testdata/rapid/TestCheckCleanupPanic/ ]; then \
	  rmdir -p --ignore-fail-on-non-empty \
	    $(M)/testdata/rapid/TestCheckCleanupPanic/; \
	fi

ifeq ($(DEB_HOST_ARCH_BITS),32)
# The test suite does not support 32-bit correctly.
override_dh_auto_test:
	-dh_auto_test
endif
