2014-05-24 13:38:41 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
|
|
|
run_vagrant() {
|
2014-07-17 20:36:09 +00:00
|
|
|
vagrant up
|
2014-05-24 13:38:41 +00:00
|
|
|
}
|
|
|
|
|
2014-07-17 20:36:09 +00:00
|
|
|
# Halt vagrant after tests are done running, unless KEEP_RUNNING environment
|
|
|
|
# variable is set to 'true'.
|
2014-05-24 13:38:41 +00:00
|
|
|
stop_vagrant() {
|
2014-07-17 20:36:09 +00:00
|
|
|
if [ -z "$KEEP_RUNNING" ]; then
|
|
|
|
vagrant halt
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
test_files() {
|
|
|
|
ls -1 ./tests/ | # test files are in `./tests/` dir
|
|
|
|
grep -i '^test' | # test file names start with 'test'
|
|
|
|
xargs # file names in one line
|
2014-05-24 13:38:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
run_tests() {
|
2014-07-17 20:36:09 +00:00
|
|
|
local test_file
|
2014-07-17 20:51:07 +00:00
|
|
|
local test_dir_path="~/tpm/tests/"
|
2014-07-17 20:36:09 +00:00
|
|
|
for test_file in $(test_files); do
|
|
|
|
echo "Running test: $test_file"
|
|
|
|
vagrant ssh -c "${test_dir_path}${test_file}"
|
|
|
|
done
|
2014-05-24 13:38:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
2014-05-24 21:18:37 +00:00
|
|
|
run_vagrant
|
|
|
|
run_tests
|
|
|
|
stop_vagrant
|
2014-05-24 13:38:41 +00:00
|
|
|
}
|
|
|
|
main
|