#!/bin/sh

set -eu

WORKDIR=$(mktemp -d)

trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM

# Copy the source tree:
cp -r . $WORKDIR
cd $WORKDIR

# Clean if necessary:
if [ -f debian/autoreconf.before ]; then
    dh_auto_clean
    dh_autoreconf_clean
fi

# Reconfigure:
dh_autoreconf
dh_auto_configure

# Run the tests:
dh_auto_test
