#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
export PYBUILD_NAME=pyppmd

PYBUILD_TEST_ARGS =
DISABLE_TESTS =

# Display each test name
PYBUILD_TEST_ARGS += --verbose

# fuzzing tests fails with timeout often
DISABLE_TESTS +=     not test_ppmd7_fuzzer
DISABLE_TESTS += and not test_ppmd8_fuzzer

# disable some tests that requires large memory
ifeq (sparc64,$(DEB_HOST_ARCH))
  DISABLE_TESTS += and not test_ppmd7_encode_decode
  DISABLE_TESTS += and not test_ppmd8_encode_decode
endif

PYBUILD_TEST_ARGS += -k "$(DISABLE_TESTS)"

# Drop benchmark test for ports architecture.
# Because "cpuinfo" module is not reliable for ports architecture.
ifeq (,$(findstring $(DEB_HOST_ARCH),amd64 arm64 armhf i386 ppc64el riscv64 s390x))
  PYBUILD_TEST_ARGS += -m "not benchmark"
endif

export PYBUILD_TEST_ARGS

%:
	dh $@ --buildsystem=pybuild
