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

# Entry point for TBC Powertrain Cooling Tests

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

# Do a bazel clean to prevent the cache from getting too large
#bazel clean


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

virtualenv -p python3.6 tbc_pt_cooling_venv
. tbc_pt_cooling_venv/bin/activate
python -m pip install -r firmware/validation/tbc_pt_cooling/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 firmware/validation/tbc_pt_cooling/test_deploy.py \
                 --verbose

# Cleanup Bazel resources
bazel clean --expunge
