#!/usr/bin/env bash
set -x

export TEST_MINOR_VER=9

unset CONDA_SHLVL
unset _CE_CONDA
unset _CE_M
unset CONDA_EXE
eval "$(python -m conda shell.bash hook)"
conda activate base
export PYTHON_MAJOR_VERSION=$(python -c "import sys; print(sys.version_info[0])")
export PYTHON_MAJ_MIN_VERSION=$(python -c "import sys; print(str(sys.version_info[0]) + '.' + str(sys.version_info[1]))")
export TEST_PLATFORM=$(python -c "import sys; print('win' if sys.platform.startswith('win') else 'unix')")
export PYTHONHASHSEED=$(python -c "import random as r; print(r.randint(0,4294967296))") && echo "PYTHONHASHSEED=$PYTHONHASHSEED"
env | sort
conda info
# These tests will not work in our test env, where no channels are available
# conda create -y -p ./built-conda-test-env python=$PYTHON_MAJ_MIN_VERSION
# conda activate ./built-conda-test-env
# echo $CONDA_PREFIX
# [ "$CONDA_PREFIX" = "$PWD/built-conda-test-env" ] || exit 1
# [ $(python -c "import sys; print(sys.version_info[1])") = 6 ] || exit 1
# conda deactivate

# Test that conda.ksh is present
test -f "${CONDA_PREFIX}/etc/profile.d/conda.ksh" || (echo "conda.ksh is missing..." && exit 1)


set -ex



bash test_runner.sh
exit 0
