if [ -z "$SAGE_LOCAL" ]; then
    echo >&2 "Error: SAGE_LOCAL undefined - exiting..."
    exit 1
fi

# Note: Running the test suite should not involve (re)compilation,
#       so we don't set CFLAGS et al. here.  (Their settings are
#       stored in the Makefiles created by 'configure' anyway.)

cd src

echo
echo "Now running GMP-ECM's test suite..."

$MAKE check
# There are potential race conditions in the long check,
# running it serially.
$MAKE -j1 longcheck

if [ $? -ne 0 ]; then
    echo >&2 "Error: GMP-ECM's test suite failed."
    exit 1
fi

echo "GMP-ECM's test suite passed."
