#!/usr/bin/make -f
#
# Univention UCS test
#  rules file for the debian package
#
# SPDX-FileCopyrightText: 2013-2026 Univention GmbH
# SPDX-License-Identifier: AGPL-3.0-only

PACKAGES := $(shell sed -rne '/^Provides:/,/^\S/{/\sucs-test-module(\s|,|$$)/{g;p}};s/Package: //;T;h' debian/control)
BLANK :=
SPACE := $(BLANK) $(BLANK)
COMMA := ,

%:
	dh $@ --with python3,univention-l10n,umc

override_dh_install:
	dh_install --sourcedir=$(CURDIR) -Xde.po
	touch debian/ucs-test-udm/usr/lib/python3/dist-packages/univention/admin/handlers/tests/__init__.py
	tar -xvzf debian/ucs-test-umc-performance/usr/share/ucs-test/91_umc-performance/hars.tar.gz -C debian/ucs-test-umc-performance/usr/share/ucs-test/91_umc-performance/

override_dh_auto_test:
	python3 -m univention.testing.data -v
	python3 -m univention.testing.errors -v
	python3 -m univention.testing.format.html -v
	python3 -m univention.testing.format.jenkins -v
	python3 -m univention.testing.format.junit -v
	python3 -m univention.testing.format.tap -v
	python3 -m univention.testing.format.text -v
	python3 -m univention.testing.internal -v
	python3 -m univention.testing.udm -v
	python3 -m univention.testing.utils -v
	unittest/run-tests.sh

override_dh_gencontrol:
	dh_gencontrol -- -Vucs-test:all-packages=$(subst $(SPACE),$(COMMA),$(PACKAGES))

override_dh_auto_clean:
	find -name '*.pyc' -delete
	dh_auto_clean
