Merge "add testsuite and testcase list pages in frontend of testing-scheduler"
[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 STYLE_CHECK_DIRS="testsuites/posca/ utils/ monitor/"
16
17 run_flake8() {
18     echo "========================================="
19     echo "Running flake8 for python style check:   "
20     echo "-----------------------------------------"
21     logfile=flake8_verify.log
22     if [ $FILE_OPTION == "f" ]; then
23        flake8 --append-config=flake8_cfg ${STYLE_CHECK_DIRS} > $logfile
24     else
25        flake8 --append-config=flake8_cfg ${STYLE_CHECK_DIRS}
26     fi
27
28     if [ $? -ne 0 ]; then
29         echo "FAILED"
30         if [ $FILE_OPTION == "f" ]; then
31             echo "Results in $logfile"
32         fi
33         exit 1
34     else
35         echo "The patch has passed python style check  "
36         echo "===================END==================="
37     fi
38 }
39
40
41 run_nosetests() {
42     echo "========================================="
43     echo "Running unit and coverage test:          "
44     echo "-----------------------------------------"
45     nosetests --with-coverage --cover-tests \
46         --cover-min-percentage 100 \
47         test/__init__.py \
48         testsuites/posca/__init__.py testsuites/__init__.py \
49         testsuites/posca/testcase_cfg/__init__.py \
50         testsuites/posca/testcase_dashboard/__init__.py \
51         testsuites/posca/testcase_script/__init__.py \
52         utils/__init__.py \
53         utils/dashboard/__init__.py \
54         utils/env_prepare/__init__.py \
55         utils/infra_setup/__init__.py \
56         monitor/__init__.py \
57         monitor/dashboard/__init__.py \
58         monitor/dispatch/__init__.py
59     echo "===================END==================="
60
61 }
62
63
64 for((i=1;i<=1;i++));do echo -e "\n";done
65 run_flake8
66
67 for((i=1;i<=1;i++));do echo -e "\n";done
68 run_nosetests