summaryrefslogtreecommitdiffstats
path: root/run_posca.sh
blob: b47a220a3333dbbb2ae343205e4facd74f4b8b4e (plain)
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
#!/bin/bash
##############################################################################
# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

pip install -U /home/opnfv/bottlenecks

function check_testcase(){

    check_suite="$1"
    SUITE_PREFIX="/home/opnfv/bottlenecks/testsuites/posca/testcase_cfg"

    TEST_CASE=$2

    #find all the test case yaml files first
    find $SUITE_PREFIX -name "*yaml" > /tmp/all_testcases.yaml
    all_testcases_insuite=`cat /tmp/all_testcases.yaml | awk -F '/' '{print $NF}' | awk -F '.' '{print $1}'`
    all_testcases=(${all_testcases_insuite})

    if [ "${TEST_CASE}" != "" ]; then
       testcase_exec=(${TEST_CASE// /})
       for i in "${testcase_exec[@]}"; do
           if [[ " ${all_testcases[*]} " != *" $i "* ]]; then
               error "unknown test case: $i. available test cases are: ${all_test_cases[@]}"
           fi
       done
       info "tests to execute: ${TEST_CASE}."
    else
       error "lack of testcase name"
    fi
}

SUITE_PREFIX="/home/opnfv/bottlenecks/testsuites/posca/testcase_cfg"
source /home/opnfv/bottlenecks/common.sh
test_file="/home/opnfv/bottlenecks/testsuites/posca/testsuite_story/posca_factor_test"
if [[ -f $test_file ]]; then
    testcases=($(cat $test_file))
else
    error "no posca test suite file "
fi

for i in "${testcases[@]}"; do
    #check if the testcase is legal or not
    check_testcase -posca $i
    #adjust config parameters
    #run test case
    file=${SUITE_PREFIX}/${i}.yaml
    python /home/opnfv/bottlenecks/testsuites/posca/run_posca.py
done