aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.ci/stress_test.sh
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-08-31 14:44:03 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-08-31 14:52:18 +0300
commiteb2cf27a842260ee557fb3ec00e1513370e294a0 (patch)
tree921cdaa42c34bdacddf6b053913d89b621069e12 /.ci/stress_test.sh
parentTravis: clang-format-9 is available on Bionic (diff)
downloadmath-server-eb2cf27a842260ee557fb3ec00e1513370e294a0.tar.gz
math-server-eb2cf27a842260ee557fb3ec00e1513370e294a0.zip
Travis: stress_test.sh: prepare to move to test/
Diffstat (limited to '.ci/stress_test.sh')
-rwxr-xr-x.ci/stress_test.sh37
1 files changed, 28 insertions, 9 deletions
diff --git a/.ci/stress_test.sh b/.ci/stress_test.sh
index 53c7bc8..eba52d2 100755
--- a/.ci/stress_test.sh
+++ b/.ci/stress_test.sh
@@ -9,10 +9,14 @@ set -o errexit -o nounset -o pipefail
script_name="$( basename -- "${BASH_SOURCE[0]}" )"
readonly script_name
+script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
+script_dir="$( cd -- "$script_dir" && pwd )"
+readonly script_dir
-readonly server_path="$HOME/install/bin/math-server"
-readonly client_path="$HOME/install/bin/math-client"
-readonly stress_test_path="$TRAVIS_BUILD_DIR/test/stress_test.py"
+install_dir="$HOME/install"
+readonly server_path='bin/math-server'
+readonly client_path='bin/math-client'
+readonly stress_test_path="$script_dir/../test/stress_test.py"
readonly server_port=16666
server_pid=
@@ -33,7 +37,7 @@ kill_server() {
run_server() {
dump "Running the server..."
- "$server_path" --port "$server_port" &
+ "$install_dir/$server_path" --port "$server_port" &
server_pid="$!"
dump "It's PID is $server_pid"
trap kill_server EXIT
@@ -41,16 +45,31 @@ run_server() {
run_stress_test() {
dump "Running stress_test.py..."
- "$stress_test_path" \
- --client "$client_path" \
- --port "$server_port" \
- --processes 4 \
+ "$stress_test_path" \
+ --client "$install_dir/$client_path" \
+ --port "$server_port" \
+ --processes 4 \
--expressions 1000
}
+script_usage() {
+ echo "usage: $script_name [INSTALL_DIR]"
+}
+
+parse_args() {
+ if [ "$#" -gt 1 ]; then
+ script_usage >&2
+ return 1
+ fi
+ if [ "$#" -gt 0 ]; then
+ install_dir="$1"
+ fi
+}
+
main() {
+ parse_args "$@"
run_server
run_stress_test
}
-main
+main "$@"