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

# Entry point for TBC HVAC Tests

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

# Run the bazel precheck steps (shutdown, remove cache)
firmware/validation/common/ci/bazel_precheck.sh

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

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

# DBC files are generated by the make_dbcs fixture defined in the dbc_builder.py plugin.

# Run Smoke Test
python -m pytest firmware/validation/tbc_hvac/test_deploy.py \
                 --verbose

# Cleanup bazel job
cd $(bazel info workspace)
firmware/validation/common/ci/bazel_postcheck.sh
