#!/bin/bash

# if ONEAPI_ROOT is specified (use all from it)
if [ -n "${ONEAPI_ROOT}" ]; then
    export DPCPPROOT=${ONEAPI_ROOT}/compiler/latest
    export MKLROOT=${ONEAPI_ROOT}/mkl/latest
    export TBBROOT=${ONEAPI_ROOT}/tbb/latest
    export DPLROOT=${ONEAPI_ROOT}/dpl/latest
fi

# if DPCPPROOT is specified (work with custom DPCPP)
if [ -n "${DPCPPROOT}" ]; then
    # shellcheck source=/dev/null
    . "${DPCPPROOT}"/env/vars.sh
fi

# if MKLROOT is specified (work with custom math library)
if [ -n "${MKLROOT}" ]; then
    # shellcheck source=/dev/null
    . "${MKLROOT}"/env/vars.sh
fi

# have to activate while SYCL CPU device/driver needs paths
# if TBBROOT is specified
if [ -n "${TBBROOT}" ]; then
    # shellcheck source=/dev/null
    . "${TBBROOT}"/env/vars.sh
fi


set -ex



python -c "import dpnp; print(dpnp.__version__)"
python -m dpctl -f
pytest -s
exit 0
