#!/bin/sh
# The command-line tools report the packaged upstream version. Only --version
# is run: nothing here starts amule, amuled or a client.
set -eu

export HOME="${AUTOPKGTEST_TMP:-$(mktemp -d)}"
version=$(dpkg-query -W -f '${source:Upstream-Version}' amule-daemon)

for tool in amuled amuleapi amuleweb amulecmd; do
	# These exit 255 after printing the version, so only the output counts.
	out=$("$tool" --version 2>&1) || true
	echo "$tool: $out"
	case "$out" in
	*"$version"*) ;;
	*) echo "FAIL: $tool does not report $version"; exit 1 ;;
	esac
done
