improve data processing script for rubbos
[bottlenecks.git] / testsuites / rubbos / run_rubbos.sh
1 #!/bin/bash
2 ###############################################################################
3 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 usage="Script to run the tests in rubbos.
12
13 usage:
14     bash $(basename "$0") [-h|--help] [-s <test suite>]
15
16 where:
17     -h|--help         show the help text
18     -t|--test         run specifif test case scenario
19       <test case>     examples:
20                                rubbos_1-1-1, rubbos_1-2-1
21
22 examples:
23     $(basename "$0")
24     $(basename "$0") -t rubbos_1-1-1"
25
26 while [[ $# > 0 ]]
27     do
28     key="$1"
29     case $key in
30         -h|--help)
31             echo "$usage"
32             exit 0
33             shift
34         ;;
35         -t|--test)
36             CASE="$2"
37             shift
38         ;;
39         *)
40             echo "unkown option $1 $2"
41             exit 1
42         ;;
43      esac
44      shift
45 done
46
47 BASEDIR=`dirname $0`
48
49 #has been checked in upper layer run_tests.sh
50 #run tests
51 if [ "${CASE}" != "" ]; then
52     case_exec=(${CASE//,/})
53     for case_exe in "${case_exec[@]}"; do
54         client_num=4
55         tomcat_num=$(echo "$case_exe"| awk -F '-' '{print $2}')
56         mysql_num=$(echo "$case_exe"| awk -F '-' '{print $3')
57
58         hosts=(rubbos_control rubbos_benchmark rubbos_httpd)
59         for((i=1; i <= client_num; i++)); do
60              hosts=(${hosts[*]} client$i)
61         done
62         for((i=1; i <= tomcat_num; i++)); do
63              hosts=(${hosts[*]} tomcat$i)
64         done
65         for((i=1; i <= mysql_num; i++)); do
66              hosts=(${hosts[*]} mysql$i)
67         done
68         bash $BOTTLENECKS_TOP_DIR/utils/infra_setup/heat_template/rubbos_heat_template/HOT_create_instance.sh
69     done
70 fi