AIO and MUNO mode upgrade for EG 1.5.0 version
[eliot.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 echo "Running unit tests..."
15
16 virtualenv ./bottlenecks_venv
17 source ./bottlenecks_venv/bin/activate
18
19 # install python packages
20 #easy_install -U setuptools
21 #easy_install -U pip
22 pip install -r ./requirements/verify.txt
23
24 getopts ":f" FILE_OPTION
25 STYLE_CHECK_DIRS="./"
26
27 run_flake8() {
28     echo "========================================="
29     echo "Running flake8 for python style check:   "
30     echo "-----------------------------------------"
31     logfile=flake8_verify.log
32     if [ $FILE_OPTION == "f" ]; then
33        flake8 --config=flake8_cfg ${STYLE_CHECK_DIRS} > $logfile
34     else
35        flake8 --config=flake8_cfg ${STYLE_CHECK_DIRS}
36     fi
37
38     if [ $? -ne 0 ]; then
39         echo "FAILED"
40         if [ $FILE_OPTION == "f" ]; then
41             echo "Results in $logfile"
42         fi
43         exit 1
44     else
45         echo "The patch has passed python style check  "
46         echo "===================END==================="
47     fi
48 }
49
50 run_yamllint() {
51     echo "========================================="
52     echo "Running yamllint for yaml style check:   "
53     echo "-----------------------------------------"
54     logfile=yamllint_verify.log
55     yamllint ./
56
57     if [ $? -ne 0 ]; then
58         echo "FAILED"
59         if [ $FILE_OPTION == "f" ]; then
60             echo "Results in $logfile"
61         fi
62         exit 1
63     else
64         echo "The patch has passed yaml style check  "
65         echo "===================END==================="
66     fi
67 }
68
69 run_nosetests() {
70     echo "========================================="
71     echo "Running unit and coverage test:          "
72     echo "-----------------------------------------"
73     echo "Do not include any coverage test yet..."
74     echo "===================END==================="
75
76 }
77
78
79 for((i=1;i<=1;i++));do echo -e "\n";done
80 run_flake8
81
82 for((i=1;i<=1;i++));do echo -e "\n";done
83 run_nosetests
84
85 for((i=1;i<=1;i++));do echo -e "\n";done
86 run_yamllint
87
88 deactivate