2014-05-24 09:38:41 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
2014-11-19 09:58:04 -05:00
|
|
|
# running test suite is successful by default
|
|
|
|
tests_exit_value=0
|
|
|
|
|
2014-05-24 09:38:41 -04:00
|
|
|
run_vagrant() {
|
2014-07-17 16:36:09 -04:00
|
|
|
vagrant up
|
2014-05-24 09:38:41 -04:00
|
|
|
}
|
|
|
|
|
2014-07-17 16:36:09 -04:00
|
|
|
# Halt vagrant after tests are done running, unless KEEP_RUNNING environment
|
|
|
|
# variable is set to 'true'.
|
2014-05-24 09:38:41 -04:00
|
|
|
stop_vagrant() {
|
2014-07-17 16:36:09 -04:00
|
|
|
if [ -z "$KEEP_RUNNING" ]; then
|
|
|
|
vagrant halt
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-05-24 09:38:41 -04:00
|
|
|
run_tests() {
|
2014-11-19 09:58:04 -05:00
|
|
|
vagrant ssh -c "cd ~/tpm; ./tests/run-tests-within-vm"
|
|
|
|
tests_exit_value=$?
|
2014-05-24 09:38:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
2014-05-24 17:18:37 -04:00
|
|
|
run_vagrant
|
|
|
|
run_tests
|
|
|
|
stop_vagrant
|
2014-11-19 09:58:04 -05:00
|
|
|
exit "$tests_exit_value"
|
2014-05-24 09:38:41 -04:00
|
|
|
}
|
|
|
|
main
|