if [ "$UNAME" = Darwin ]; then
    CC=clang
    CXX=clang++
fi

cd src
unset MACOSX_DEPLOYMENT_TARGET
# Supress tests failing for reason out of our controls
FAILING_TESTS="CTestTestStopTime|TestUpload|ctest_submit"
# gui interface may pull dependency conflicting with
# sage libraries
# (1) QT libraries
FAILING_TESTS="${FAILING_TESTS}|Qt5Autogen|Qt4Autogen|Qt4Targets|Qt4And5AutomocReverse"
# (2) GTK2
FAILING_TESTS="${FAILING_TESTS}|GTK2Components|GTK2Targets"
# BundleUtilities test is failing on some platforms, skipped in Gentoo for that reason
FAILING_TESTS="${FAILING_TESTS}|BundleUtilities"
# Test failing on freeBSD. Upstream acknoledged the test is faulty
# on that platform https://gitlab.kitware.com/cmake/cmake/issues/16887
if [ "$UNAME" = "FreeBSD" ]; then
    FAILING_TESTS="${FAILING_TESTS}|RunCMake.GNUInstallDirs"
fi
ctest --extra-verbose --output-on-failure -E "(${FAILING_TESTS})"

