#!/bin/sh
# Copyright 2015 Ghislain Antony Vaillant
#
# This file is part of the autopkgtest testsuite for ArrayFire.

set -e

# Presence of $ADTTMP implies that someone will handle cleanup for us, so we
# can avoid duplicating the effort (signal handling, etc.) here.
if [ -z "$ADTTMP" ]
then
	echo "Required envvar \"$ADTTMP\"is not set" >&2
	exit 1
fi

SRCDIR=`pwd`
cd "$ADTTMP"
cmake "$SRCDIR/test"
echo "configure: OK"
make
echo "build: OK"
CTEST_OUTPUT_ON_FAILURE=1
if ctest --force-new-ctest-process -R "cpu" -E "large|dense"; then
  echo "run: OK (cpu)"
else
  echo "run: NOT OK (cpu)"
fi
if ctest --force-new-ctest-process -R "unified" -E "large|dense"; then
  echo "run: OK (unified)"
else
  echo "run: NOT OK (unified)"
fi
