#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DH_GOLANG_EXCLUDES := \
	apptest/ \
	# EOL

export DH_GOLANG_INSTALL_EXTRA := \
	app/vmalert/templates/templates/ \
	app/vmselect/graphite/functions.json \
	lib/httpserver/favicon.ico \
	# EOL

%:
	dh $@ --builddirectory=_build --buildsystem=golang

# Ignore errors due to floating point comparisons w/o epsilon.
ifeq (,$(filter $(DEB_HOST_ARCH),amd64 i386 armel))
  TESTS_FLAKY = yes
endif

TESTS_SKIP =
# Ignore specific tests due to 32-bit time_t and off_t.
ifneq (,$(filter $(DEB_HOST_ARCH),i386))
  TESTS_SKIP = -skip 'TestStorage_futureTimestamps|TestDecompressLimitedFail'
endif

override_dh_auto_test:
ifeq ($(TESTS_FLAKY),yes)
	@echo "Notice: Running tests in flaky mode, errors will be ignored."
endif
	$(if $(TESTS_FLAKY),-)dh_auto_test -- $(TESTS_SKIP)
