summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2017-02-02 13:43:17 +0000
committerMartin Klozik <martinx.klozik@intel.com>2017-02-16 10:39:47 +0000
commita4a8e7598a82189d16f68a4e113447fc344464c7 (patch)
treee625d51f578eaef924f804609cd50e5ab0c20e34 /ci
parentca9c9275ed6d5d852987c69a378e88a3502cb2ab (diff)
ci: Execute pylint checks by VERIFY and MERGE jobs
Pylint should be executed automatically for every patch to assure, that new code meets vsperf coding standards. JIRA: VSPERF-114 Change-Id: Icb1000e207b2d728497ff3d349fb3cb8334baac7 Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Diffstat (limited to 'ci')
-rwxr-xr-xci/build-vsperf.sh30
1 files changed, 25 insertions, 5 deletions
diff --git a/ci/build-vsperf.sh b/ci/build-vsperf.sh
index 24fbb8fa..7771a568 100755
--- a/ci/build-vsperf.sh
+++ b/ci/build-vsperf.sh
@@ -27,8 +27,9 @@
EXIT=0
EXIT_TC_FAILED=1
EXIT_SANITY_TC_FAILED=2
-EXIT_NO_RESULTS=10
-EXIT_NO_TEST_REPORT_LOG_DIR=11
+EXIT_PYLINT_FAILED=4
+EXIT_NO_RESULTS=128
+EXIT_NO_TEST_REPORT_LOG_DIR=256
#
# configuration
@@ -188,7 +189,7 @@ function execute_vsperf() {
exit $EXIT_NO_RESULTS
else
print_results "${RES_DIR}"
- if [ "$EXIT" -eq "$EXIT_TC_FAILED" ] ; then
+ if [ $(($EXIT & $EXIT_TC_FAILED)) -gt 0 ] ; then
echo "-------------------------------------------------------------------"
cat $LOG_FILE
echo "-------------------------------------------------------------------"
@@ -308,20 +309,28 @@ function execute_vsperf_sanity() {
echo >> $LOG_FILE
done
echo "Sanity log file $LOG_FILE"
- if [ "$EXIT" -ne "0" ] ; then
+ if [ $(($EXIT & $EXIT_SANITY_TC_FAILED)) -gt 0 ] ; then
echo "-------------------------------------------------------------------"
cat $LOG_FILE
echo "-------------------------------------------------------------------"
fi
}
+# execute pylint to check code quality
+function execute_vsperf_pylint_check() {
+ if ! ./check -b ; then
+ EXIT=$EXIT_PYLINT_FAILED
+ fi
+}
+
# check and install required packages at nodes running VERIFY and MERGE jobs
function dependencies_check() {
. /etc/os-release
if [ $ID == "ubuntu" ] ; then
echo "Dependencies check"
echo "=================="
- for PACKAGE in "python3-tk" "sysstat" ; do
+ # install system packages
+ for PACKAGE in "python3-tk" "sysstat" "bc" ; do
if dpkg -s $PACKAGE &> /dev/null ; then
printf " %-70s %-6s\n" $PACKAGE "OK"
else
@@ -329,6 +338,15 @@ function dependencies_check() {
sudo apt-get install -y $PACKAGE
fi
done
+ # install additional python packages into python environment
+ for PACKAGE in "pylint" ; do
+ if pip show $PACKAGE &> /dev/null ; then
+ printf " %-70s %-6s\n" $PACKAGE "OK"
+ else
+ printf " %-70s %-6s\n" $PACKAGE "missing"
+ pip install $PACKAGE
+ fi
+ done
echo
fi
}
@@ -386,6 +404,7 @@ case $1 in
echo "VSPERF verify job"
echo "================="
+ execute_vsperf_pylint_check
terminate_vsperf
execute_vsperf_sanity
terminate_vsperf
@@ -400,6 +419,7 @@ case $1 in
echo "VSPERF merge job"
echo "================"
+ execute_pylint_check
terminate_vsperf
execute_vsperf_sanity
terminate_vsperf