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

# CI Entry point for LLC smoke tests
git clean -fdx  # Clean out anything that might be lurking around...

# Export QNX enable variable
export ZOOX_ENABLE_QNX70=1

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


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


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

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

# GENERATE DBCS #
# As far as I know, DBCs for L3 are just stashed in the repo, not generated
# So this is a placeholder section

# Deploy First!
python -m pytest --exitfirst --verbose firmware/validation/llcv6_feature/test_deploy.py

# Now run some smoke tests
python -m pytest --exitfirst --verbose firmware/validation/llcv6_feature/test_llc_main_states.py

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