2 ##############################################################################
3 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
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 ##############################################################################
11 usage="Script to run the tests in bottlenecks auto.
14 bash $(basename "$0") [-h|--help] [-s <test suite>]
17 -h|--help show the help text
18 -r|--report push results to DB(true by default)
19 -s|--suite run specific test suite
20 <test suite> one of the following:
25 $(basename "$0") -s rubbos"
29 arr_test_suite=(rubbos vstf)
31 function check_testcase(){
36 SUITE_PREFIX=$SUITE_PREFIX_CONFIG/rubbos/testcase_cfg
39 SUITE_PREFIX=$SUITE_PREFIX_CONFIG/vstf/testcase_cfg
45 #find all the test case yaml files first
46 find $SUITE_PREFIX -name "*yaml" > /tmp/all_testcases.yaml
47 all_testcases_insuite=`cat /tmp/all_testcases.yaml | awk -F '/' '{print $NF}' | awk -F '.' '{print $1}'`
48 all_testcases=(${all_testcases_insuite})
50 if [ "${TEST_CASE}" != "" ]; then
51 testcase_exec=(${TEST_CASE// /})
52 for i in "${testcase_exec[@]}"; do
53 if [[ " ${all_testcases[*]} " != *" $i "* ]]; then
54 error "unknown test case: $i. available test cases are: ${all_test_cases[@]}"
57 info "tests to execute: ${TEST_CASE}."
59 error "lack of testcase name"
65 echo "Running test suite $test_suite"
69 info "Running rubbos test suite"
70 test_file="/home/opnfv/bottlenecks/testsuites/rubbos/testsuite_story/rubbos_story1"
71 if [[ -f $test_file ]]; then
72 testcases=($(cat $test_file))
74 error "no rubbos test suite file"
76 for i in "${testcases[@]}"; do
77 #check if the testcase is legal or not
78 check_testcase -rubbos $i
79 #adjust config parameters, different test suite has different methods, take rubbos as an example
80 #run test case, different test suite has different methods
81 file=${BASEDIR}/testsuites/rubbos/testcase_cfg/${i}.yaml
82 python /home/opnfv/bottlenecks/testsuites/rubbos/run_rubbos.py -c $file
86 info "Running vstf test suite"
87 test_file="/home/opnfv/bottlenecks/testsuites/vstf/testsuite_story/vstf_story1"
88 if [[ -f $test_file ]]; then
89 testcases=($(cat $test_file))
91 error "no vstf test suite file "
93 for i in "${testcases[@]}"; do
94 #check if the testcase is legal or not
95 check_testcase -vstf $i
96 #adjust config parameters
98 file=${BASEDIR}/testsuites/vstf/testcase_cfg/${i}.yaml
99 python /home/opnfv/bottlenecks/testsuites/vstf/run_vstf.py -c $file
122 echo "unkown option $1 $2"
130 source ${BASEDIR}/common.sh
132 #check the test suite name is correct
133 if [ "${SUITE}" != "" ]; then
134 suite_exec=(${SUITE//,/ })
135 for i in "${suite_exec[@]}"; do
136 if [[ " ${arr_test_suite[*]} " != *" $i "* ]]; then
137 error "unkown test suite: $i"
140 info "Tests to execute: ${SUITE}"
144 info "Sourcing Credentials openstack.creds to run the tests.."
145 source /home/opnfv/bottlenecks/config/openstack.creds
148 if [ "${SUITE}" != "" ]; then
149 for i in "${suite_exec[@]}"; do