2012-09-04 13:14:55 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Specify the path to the RDL repo as argument one.
|
|
|
|
# Argument 2 cna be a log file for the RDL output.
|
|
|
|
# This script will create a .pid file and report in the current directory.
|
|
|
|
|
|
|
|
set -e
|
2012-11-08 15:35:06 -08:00
|
|
|
|
|
|
|
me=${0##*/}
|
|
|
|
|
|
|
|
function print_usage() {
|
|
|
|
cat >&2 <<EOS
|
2013-06-17 23:34:27 -07:00
|
|
|
Run tests against a local instance of trove
|
2012-11-08 15:35:06 -08:00
|
|
|
|
2013-06-17 23:34:27 -07:00
|
|
|
Usage: $me trove_path [logfile]
|
2012-11-08 15:35:06 -08:00
|
|
|
EOS
|
|
|
|
}
|
|
|
|
|
|
|
|
# parse options
|
|
|
|
while getopts ":h" opt; do
|
|
|
|
case "$opt" in
|
|
|
|
h|\?) print_usage; exit 5 ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $((OPTIND-1))
|
|
|
|
|
2012-09-04 13:14:55 -05:00
|
|
|
if [ $# -lt 1 ]; then
|
2012-11-08 15:35:06 -08:00
|
|
|
print_usage
|
2012-09-04 13:14:55 -05:00
|
|
|
exit 5
|
|
|
|
fi
|
|
|
|
|
2013-06-17 23:34:27 -07:00
|
|
|
trove_path=$1
|
|
|
|
trove_pid_file="`pwd`.pid"
|
2012-09-04 13:14:55 -05:00
|
|
|
|
|
|
|
function start_server() {
|
2013-02-08 14:50:44 -06:00
|
|
|
server_log=`pwd`/rdserver.txt
|
|
|
|
set +e
|
|
|
|
rm $server_log
|
|
|
|
set -e
|
2013-06-17 23:34:27 -07:00
|
|
|
pushd $trove_path
|
|
|
|
bin/start_server.sh --pid-file=$trove_pid_file \
|
2013-02-08 14:50:44 -06:00
|
|
|
--override-logfile=$server_log
|
2012-09-04 13:14:55 -05:00
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
|
|
|
function stop_server() {
|
2013-06-17 23:34:27 -07:00
|
|
|
if [ -f $trove_pid_file ];
|
2012-09-04 13:14:55 -05:00
|
|
|
then
|
2013-06-17 23:34:27 -07:00
|
|
|
pushd $trove_path
|
|
|
|
bin/stop_server.sh $trove_pid_file
|
2012-09-04 13:14:55 -05:00
|
|
|
popd
|
|
|
|
else
|
|
|
|
echo "The pid file did not exist, so not stopping server."
|
|
|
|
fi
|
|
|
|
}
|
2012-11-08 15:35:06 -08:00
|
|
|
|
2012-09-04 13:14:55 -05:00
|
|
|
function on_error() {
|
|
|
|
echo "Something went wrong!"
|
|
|
|
stop_server
|
|
|
|
}
|
|
|
|
|
|
|
|
trap on_error EXIT # Proceed to trap - END in event of failure.
|
|
|
|
|
|
|
|
start_server
|
2013-02-08 14:50:44 -06:00
|
|
|
tox -edocs
|
|
|
|
mkdir -p .tox/docs/html
|
|
|
|
.tox/docs/bin/sphinx-build -b doctest docs/source .tox/docs/html
|
|
|
|
.tox/docs/bin/sphinx-build -b html docs/source .tox/docs/html
|
2012-09-04 13:14:55 -05:00
|
|
|
stop_server
|
|
|
|
|
|
|
|
|
|
|
|
trap - EXIT
|
|
|
|
echo "Ran tests successfully. :)"
|
|
|
|
exit 0
|