From de6c5412941a5945af9f7176595632499a983c81 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Mon, 25 Apr 2016 15:37:45 +0200 Subject: diffoscope distribution tests: add tests for FreeBSD, NetBSD and MacPorts --- bin/diffoscope_distribution_test.sh | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'bin/diffoscope_distribution_test.sh') diff --git a/bin/diffoscope_distribution_test.sh b/bin/diffoscope_distribution_test.sh index cbb7207d..722e4305 100755 --- a/bin/diffoscope_distribution_test.sh +++ b/bin/diffoscope_distribution_test.sh @@ -30,15 +30,38 @@ check_pypi() { fi } +check_whohas() { + # the following is "broken" as sort doesn't do proper version comparison + DIFFOSCOPE_IN_WHOHAS=$(whohas -d $DISTRIBUTION diffoscope | awk '{print $3}' | sort -u | tail -1) + echo + echo + if [ "$DIFFOSCOPE_IN_DEBIAN" = "$DIFFOSCOPE_IN_WHOHAS" ] ; then + echo "Yay. diffoscope in Debian has the same version as $DISTRIBUTION has: $DIFFOSCOPE_IN_DEBIAN" + elif dpkg --compare-versions "$DIFFOSCOPE_IN_DEBIAN" gt "$DIFFOSCOPE_IN_WHOHAS" ; then + echo "Fail: diffoscope in Debian: $DIFFOSCOPE_IN_DEBIAN" + echo "Fail: diffoscope in $DISTRIBUTION: $DIFFOSCOPE_IN_WHOHAS" + exit 1 + else + echo "diffoscope in Debian: $DIFFOSCOPE_IN_DEBIAN" + echo "diffoscope in $DISTRIBUTION: $DIFFOSCOPE_IN_WHOHAS" + echo + echo "Failure is the default action…" + exit 1 + fi +} + + # # main # DIFFOSCOPE_IN_DEBIAN=$(rmadison diffoscope|egrep '(unstable|sid)'| awk '{print $3}' || true) case $1 in - pypi) + PyPI) check_pypi + ;; + FreeBSD|NetBSD|MacPorts) DISTRIBUTION=$1 - check_pypi + check_whohas ;; *) echo "Unsupported distribution." @@ -46,5 +69,3 @@ case $1 in ;; esac - - -- cgit v1.2.3-54-g00ecf