Merge "Documentation on storage testcases in bottlenecks"
[bottlenecks.git] / verify.sh
1 #!/bin/bash
2
3 ##############################################################################
4 # Copyright (c) 2016 Huawei Tech and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12 # Run flake8, unit, coverage test
13
14 getopts ":f" FILE_OPTION
15
16 run_flake8() {
17     echo "========================================="
18     echo "Running flake8 for python style check:   "
19     echo "-----------------------------------------"
20     logfile=flake8_verify.log
21     if [ $FILE_OPTION == "f" ]; then
22        flake8 --append-config=flake8_cfg testsuites/posca/ utils/ > $logfile
23     else
24        flake8 --append-config=flake8_cfg testsuites/posca/ utils/
25     fi
26
27     if [ $? -ne 0 ]; then
28         echo "FAILED"
29         if [ $FILE_OPTION == "f" ]; then
30             echo "Results in $logfile"
31         fi
32         exit 1
33     else
34         echo "The patch has passed python style check  "
35         echo "===================END==================="
36     fi
37 }
38
39
40 run_nosetests() {
41     echo "========================================="
42     echo "Running unit and coverage test:          "
43     echo "-----------------------------------------"
44     nosetests --with-coverage --cover-tests \
45         --cover-min-percentage 100 \
46         test/__init__.py \
47         testsuites/posca/__init__.py testsuites/__init__.py \
48         testsuites/posca/testcase_cfg/__init__.py \
49         testsuites/posca/testcase_dashboard/__init__.py \
50         testsuites/posca/testcase_script/__init__.py \
51         utils/__init__.py \
52         utils/dashboard/__init__.py \
53         utils/env_prepare/__init__.py \
54         utils/infra_setup/__init__.py \
55         monitor/__init__.py \
56         monitor/config/__init__.py
57     echo "===================END==================="
58
59 }
60
61
62 for((i=1;i<=1;i++));do echo -e "\n";done
63 run_flake8
64
65 for((i=1;i<=1;i++));do echo -e "\n";done
66 run_nosetests