#!/bin/sh

# see https://salsa.debian.org/ci-team/autopkgtest/-/merge_requests/430#note_520138
# (same as liborcus)
if [ ! -f ./src/libixion/general_test.o ]; then
	export DEB_BUILD_OPTIONS="`echo $DEB_BUILD_OPTIONS | sed -e s/nocheck//`"
	debian/rules override_dh_auto_test-arch
fi

# remove locally built libixion so that we actually test the system one
versions="$(dpkg --no-pager -l 'libixion-*'|awk '/^ii/ {} /libixion-[0-9]/ {print $2}'|cut -d: -f1|cut -d- -f2)"
for v in $versions; do
    echo deleting the following files:
    find . -name "*${v}.so*"
    find . -name "*${v}.so*" -delete
done
if [ -d ./src/python/.libs ]; then
	rm -rfv ./src/python/.libs
fi

make check
