-
Notifications
You must be signed in to change notification settings - Fork 52
/
run_local.sh
executable file
·73 lines (59 loc) · 1.4 KB
/
run_local.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/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
me=${0##*/}
function print_usage() {
cat >&2 <<EOS
Run tests against a local instance of trove
Usage: $me trove_path [logfile]
EOS
}
# parse options
while getopts ":h" opt; do
case "$opt" in
h|\?) print_usage; exit 5 ;;
esac
done
shift $((OPTIND-1))
if [ $# -lt 1 ]; then
print_usage
exit 5
fi
trove_path=$1
trove_pid_file="`pwd`.pid"
function start_server() {
server_log=`pwd`/rdserver.txt
set +e
rm $server_log
set -e
pushd $trove_path
bin/start_server.sh --pid-file=$trove_pid_file \
--override-logfile=$server_log
popd
}
function stop_server() {
if [ -f $trove_pid_file ];
then
pushd $trove_path
bin/stop_server.sh $trove_pid_file
popd
else
echo "The pid file did not exist, so not stopping server."
fi
}
function on_error() {
echo "Something went wrong!"
stop_server
}
trap on_error EXIT # Proceed to trap - END in event of failure.
start_server
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
stop_server
trap - EXIT
echo "Ran tests successfully. :)"
exit 0