#!/bin/bash

# Install Flash with user mode.
echo "Install Flash in user mode..."
./bin/userMode.sh >> /dev/null 2>&1
echo "Done."

echo
pip list | grep -i pingcap.pe.flash
echo

# Install Flash into course repo.
flash-init-course-folder.sh .

# Run FT test. And, re-install Flash with developer mode on test failure.
python tests/full-test.py || (echo "Test failed. Please check your code or environment and re-run the test again. Install Flash in developer mode..." && ./bin/devMode.sh >> /dev/null && echo "Done.")

# Verify that Flash is installed at the repository path.
echo
pip list | grep -i pingcap.pe.flash
echo
