#!/bin/sh

set -eu

if [ $# -lt 1 ]; then
  echo "usage: $0 [AUTOPKGTEST ARGUMENTS ...]"
  exit 1
fi

rc=0
autopkgtest \
  --no-built-binaries \
  --setup-commands="echo '${debci_test_package} ${debci_suite}/${debci_arch}' > /var/tmp/debci.pkg 2>&1 || true" \
  ${debci_autopkgtest_args:-} \
  "$@" || rc=$?

if [ -n "${debci_test_outputdir:-}" ]; then
  echo $rc > "$debci_test_outputdir/exitcode"
fi
exit $rc
