#!/usr/bin/make -f

ifneq (,$(DEB_MAINTAINER_MODE))
NETWORK = --network
endif

# The following programs are not packaged for Debian and thus
# the test is not supported
NOT_SUPPORTED_TESTS=Blat \
                    Eponine \
                    Glimmer2 \
                    Gumby \
                    RepeatMasker \
                    Phyml \
                    Hyphy

# fpr exclusion of Phyml and Hyphy tests see bug #906337
#                    Cap3 - some sensible tests seem to run despite this is not packaged

# The following tests should work but are missing to be packaged BioPerl modules
FAILING_TESTS_FOR_DUE_TO_MISSING_MODULES=BWA \
                                         MCS

# Important for hyphympi
# See https://lists.debian.org/debian-science/2012/03/msg00005.html
export OMPI_MCA_plm_rsh_agent=/bin/false
export OMPI_MCA_rmaps_base_oversubscribe=1

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- --install_scripts $(NETWORK)

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	mkdir t.skip
	for t in $(NOT_SUPPORTED_TESTS) $(FAILING_TESTS_FOR_DUE_TO_MISSING_MODULES) ; do mv t/$${t}.t t.skip ; done
	PATH=$$PATH:/usr/lib/emboss:/usr/lib/phylip/bin/:/usr/lib/tigr-glimmer:debian/test_hack_bin \
	HOME_4_TCOFFEE=/tmp COILSDIR=/usr/share/ncoils/ \
	    dh_auto_test --no-parallel
	mv t.skip/* t
	rm -rf t.skip
endif
