#! /bin/sh
set -xe
origin="$PWD"

# Entry point for DCU Feature Tests

# Clean out anything that might be lurking around...
#git clean -fdx

# Export QNX enable variable
export ZOOX_ENABLE_QNX70=1

# Do a bazel shutdown before clearing out bazel cache
#bazel shutdown

# Clear out bazel cache
#rm -rf ~/.cache/bazel/


# Set up virtualenv
if [ -d dcu_feature_env ]; then
    rm -rf dcu_feature_env
fi

virtualenv -p python3.6 dcu_feature_env
. dcu_feature_env/bin/activate
python -m pip install -r firmware/validation/dcu_feature/requirements.txt

# Generate DBCs first. If this fails there is no point in continuing to test
# Note that this does not upload DBCs to Artifactory. To enable upload use the
# upload_dbc.sh script instead
firmware/validation/common/ci/generate_dbc.sh

# Run Smoke Test
python -m pytest --exitfirst --verbose firmware/validation/dcu_feature/test_deploy.py
python -m pytest --exitfirst --verbose firmware/validation/dcu_feature/test_cpu_resources.py

# Run everything else
#python -m pytest --verbose firmware/validation/dcu_feature/ --ignore=firmware/validation/dcu_feature/test_deploy.py
