#!/usr/bin/make -f

DEB_HOST_ARCH_BITS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS)

# Exclude the webhook test server "package main"; dh-golang would otherwise
# build and install it as /usr/bin/main in the -dev package (an arch-dependent,
# unstripped binary with no manpage in an arch:all package). It is only a
# developer helper and is not imported by any package.
export DH_GOLANG_EXCLUDES := \
  pkg/admission/plugin/webhook/testing/main

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

# The API Priority & Fairness fair-queuing simulations in
# pkg/util/flowcontrol/fairqueuing/queueset run clock-driven concurrency tests
# that are too slow on 32-bit architectures, where they exceed the test timeout
# and get killed (FTBFS on i386). Skip just those simulation tests on 32-bit
# arches; the rest of the suite still runs, and all of it runs on 64-bit arches.
ifeq ($(DEB_HOST_ARCH_BITS),32)
override_dh_auto_test:
	dh_auto_test -- -skip '^(TestNoRestraint|TestBaseline|TestExampt|TestSeparations|TestUniformFlowsHandSize[13]|TestDifferentFlowsExpectEqual|TestDifferentFlowsExpectUnequal|TestDifferentFlowsWithoutQueuing|TestDifferentWidths|TestTooWide|TestWindup)$$'
endif
