Skip to content

Commit

Permalink
ci: align kw check to requirements & add kw issues report
Browse files Browse the repository at this point in the history
  • Loading branch information
kraszkow authored and svenwoop committed Jan 21, 2021
1 parent a1ebb79 commit a2b90bd
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 27 deletions.
34 changes: 26 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
## Copyright 2009-2021 Intel Corporation
## SPDX-License-Identifier: Apache-2.0

stages:
- test
- scan-report


#####################################################################
# Continuous Test
####################################################################
Expand All @@ -24,7 +29,7 @@ continuous-windows-x64-RelWithDebInfo-V141-ISPC1.13.0-SSE2-TBB2020.2:
script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:V141 ispc:ispc1.13.0 isa:SSE2 tasking:TBB2020.2 intensity:2 maxinstancelevelcount:8"
tags: [embree, win10, v141]
only: [pushes]

continuous-macosx-x64-Debug-CLANG-ISPC1.13.0-SSE2-TBB2020.2:
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG ispc:ispc1.13.0 isa:SSE2 tasking:TBB2020.2 intensity:2"
tags: [embree, mac]
Expand Down Expand Up @@ -72,11 +77,24 @@ continuous-fedora32-x64-Debug-GCC-ISPC-AVX512-TBB:
tags: [embree, docker, avx512vl]
only: [pushes]

continuous-linux-x64-Debug-GCC-ISPC1.13.0-SSE2-TBB-KLOCKWORK:
continuous-linux-x64-Debug-GCC-ISPC1.13.0-SSE2-TBB-KLOCWORK:
image: $DOCKER_REGISTRY/embree/centos:7.4
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc1.13.0 isa:SSE2 tasking:TBB klocwork:ON intensity:0"
tags: [embree, docker]
dependencies: []
artifacts:
paths: [klocwork/*]

continuous-kw-gen-report:
stage: scan-report
image: $DOCKER_REGISTRY/embree/centos:7.4
needs: [continuous-linux-x64-Debug-GCC-ISPC1.13.0-SSE2-TBB-KLOCWORK]
script:
- scripts/klocwork_gen_report.sh
- scripts/store_files.sh $CI_PROJECT_NAME $CI_PIPELINE_ID klocwork "klocwork/report.log"
tags: [embree, docker]
artifacts:
paths: [klocwork/*]

continuous-linux-x64-PROTEX:
image: amd64/openjdk:8
Expand All @@ -102,7 +120,7 @@ nightly-windows-Win32-RelWithDebInfo-V140-ISPC1.12.0-SSE2-TBB2020.2:
script: "python scripts\\test.py platform:Win32 build:RelWithDebInfo compiler:V140 ispc:ispc1.12.0 isa:SSE2 tasking:TBB2020.2 intensity:2"
tags: [embree, win10, v140]
only: [schedules]

nightly-windows-x64-RelWithDebInfo-V140-ISPC1.12.0-AVX2-PPL:
script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:V140 ispc:ispc1.12.0 isa:AVX2 frequency_level:simd256 tasking:PPL intensity:2"
tags: [embree, win10, v140, avx2]
Expand All @@ -127,7 +145,7 @@ nightly-windows-x64-RelWithDebInfo-ICC17-ISPC1.13.0-AVX2-TBB2019.2:
script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:ICC17-VC14 ispc:ispc1.13.0 isa:AVX2 frequency_level:simd128 tasking:TBB2019.2 intensity:4"
tags: [embree, win10, icc17]
only: [schedules]

#nightly-windows-x64-RelWithDebInfo-ICC18-ISPC1.13.0-AVX512-TBB2020.2:
# script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:ICC18-VC14 ispc:ispc1.13.0 isa:AVX512 tasking:TBB2020.2 intensity:2"
# tags: [embree, win10, icc18, avx512vl]
Expand Down Expand Up @@ -216,7 +234,7 @@ nightly-linux-avx512vl-x64-Debug-CLANG4.0.0-ISPC1.13.0-AVX512-TBB2020.2:
nightly-linux-x64-Debug-GCC-ISPC1.13.0-SSE2-TBB2020.2:
image: $DOCKER_REGISTRY/embree/fedora:25
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc1.13.0 isa:SSE2 tasking:TBB2020.2 intensity:4"
tags: [embree, docker]
tags: [embree, docker]
only: [schedules]

nightly-linux-x64-Debug-GCC-ISPC1.13.0-AVX-TBB2019.9:
Expand Down Expand Up @@ -283,7 +301,7 @@ nightly-ubuntu20.04-x64-Release-GCC-ISPC1.14.1-AVX2-TBB2021.1.1:
script: "scripts/test.py platform:x64 build:Release compiler:GCC ispc:ispc1.14.1 isa:AVX2 tasking:TBB2021.1.1 intensity:2"
tags: [embree, docker]
only: [schedules]

nightly-ubuntu16.04-x64-Debug-GCC-ISPC1.13.0-AVX2-TBB:
image: $DOCKER_REGISTRY/embree/ubuntu:16.04
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc1.13.0 isa:AVX2 tasking:TBB MIN_WIDTH:ON intensity:3"
Expand Down Expand Up @@ -313,7 +331,7 @@ nightly-fedora28-x64-Debug-GCC-ISPC-AVX512-TBB:
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc isas:SSE2-SSE42-AVX-AVX2-AVX512 tasking:TBB intensity:3"
tags: [embree, docker, avx512vl]
only: [schedules]

nightly-fedora27-x64-Debug-GCC-ISPC-AVX2-TBB:
image: $DOCKER_REGISTRY/embree/fedora:27
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc isa:AVX2 tasking:TBB intensity:3"
Expand All @@ -325,7 +343,7 @@ nightly-fedora26-x64-Debug-GCC-ISPC-AVX2-TBB:
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc isa:AVX2 tasking:TBB intensity:3"
tags: [embree, docker]
only: [schedules]

nightly-fedora25-x64-Debug-GCC-ISPC-AVX2-TBB:
image: $DOCKER_REGISTRY/embree/fedora:25
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc isa:AVX2 tasking:TBB intensity:3"
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
numpy
sympy
math
14 changes: 9 additions & 5 deletions scripts/klocwork_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ KW_CLIENT_PATH=$KW_PATH/client
export KLOCWORK_LTOKEN=/tmp/ltoken

echo "$KW_SERVER_IP;$KW_SERVER_PORT;$KW_USER;$KW_LTOKEN" > $KLOCWORK_LTOKEN

mkdir -p $CI_PROJECT_DIR/klocwork
log_file=$CI_PROJECT_DIR/klocwork/build.log

make clean > /dev/null
$KW_CLIENT_PATH/bin/kwinject -w -o buildspec.txt make -j 8
$KW_SERVER_PATH/bin/kwbuildproject --classic --force --url http://$KW_SERVER_IP:$KW_SERVER_PORT/embree buildspec.txt --tables-directory $CI_PROJECT_DIR/kw_tables
$KW_SERVER_PATH/bin/kwadmin --url http://$KW_SERVER_IP:$KW_SERVER_PORT/ load --force --name build-$CI_JOB_ID embree $CI_PROJECT_DIR/kw_tables
$KW_CLIENT_PATH/bin/kwinject -w -o buildspec.txt make -j 8 | tee -a $log_file
$KW_SERVER_PATH/bin/kwbuildproject --classic --force --url http://$KW_SERVER_IP:$KW_SERVER_PORT/embree buildspec.txt --tables-directory $CI_PROJECT_DIR/kw_tables | tee -a $log_file
$KW_SERVER_PATH/bin/kwadmin --url http://$KW_SERVER_IP:$KW_SERVER_PORT/ load --force --name build-$CI_JOB_ID $KW_PROJECT_NAME $CI_PROJECT_DIR/kw_tables | tee -a $log_file

# store kw build number for check status later
echo "build-$CI_JOB_ID" > ./kw_build_number
# Store kw build name for check status later
echo "build-$CI_JOB_ID" > $CI_PROJECT_DIR/klocwork/build_name
27 changes: 13 additions & 14 deletions scripts/klocwork_check.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
#!/bin/bash

## Copyright 2009-2021 Intel Corporation
#!/bin/bash -xe
## Copyright 2020-2021 Intel Corporation
## SPDX-License-Identifier: Apache-2.0

set -e
export KW_BUILD_NUMBER=$(cat ./kw_build_number)
export KW_PROJECT_NAME=embree
export KW_CRITICAL_OUTPUT_PATH=./kw_critical.out
KW_ISSUES_FILE=/tmp/issues
KW_SERVER_API_URL=http://$KW_SERVER_IP:$KW_SERVER_PORT/review/api
KW_BUILD_NAME=$(cat $CI_PROJECT_DIR/klocwork/build_name)

echo "Checking for critical issues in $KW_BUILD_NUMBER ..."
no_proxy=$KW_SERVER_IP curl -f --data "action=search&project=$KW_PROJECT_NAME&query=build:'$KW_BUILD_NUMBER'%20severity:Error,Critical%20status:Analyze,Fix&user=$KW_USER&ltoken=$KW_LTOKEN" http://$KW_SERVER_IP:$KW_SERVER_PORT/review/api -o $KW_CRITICAL_OUTPUT_PATH
echo "Checking for issues in $KW_BUILD_NAME ..."
curl -f --data "action=search&project=$KW_PROJECT_NAME&query=build:'$KW_BUILD_NAME'%20status:Analyze,Fix,Fix%20in%20Next%20Release,Fix%20in%20Later%20Release,Defer,Filter&user=$KW_USER&ltoken=$KW_LTOKEN" $KW_SERVER_API_URL -o $KW_ISSUES_FILE
getCriticalCount() {
cat $KW_CRITICAL_OUTPUT_PATH | wc -l
cat $KW_ISSUES_FILE | wc -l
}
if [ -f $KW_CRITICAL_OUTPUT_PATH ]; then
echo "****** ERROR ****** Critical issues found - $(getCriticalCount) in $KW_BUILD_NUMBER";
cat $KW_CRITICAL_OUTPUT_PATH
if [ -f $KW_ISSUES_FILE ]; then
echo "Issues found - $(getCriticalCount) in $KW_BUILD_NAME";
while IFS= read -r line; do echo $line | python -m json.tool; done < $KW_ISSUES_FILE
exit 1;
else
echo "****** PASS ****** No critical issues were found in $KW_BUILD_NUMBER"
echo "There are no issues which should be take care in $KW_BUILD_NAME"
fi

39 changes: 39 additions & 0 deletions scripts/klocwork_gen_report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash -xe
## Copyright 2020-2021 Intel Corporation
## SPDX-License-Identifier: Apache-2.0

KW_SERVER_API_URL=http://$KW_SERVER_IP:$KW_SERVER_PORT/review/api
KW_BUILD_NAME=$(cat $CI_PROJECT_DIR/klocwork/build_name)
KW_BUILD_LOG_FILE=$CI_PROJECT_DIR/klocwork/build.log

export PATH="$SHARED_TOOLS_PATH:$PATH"

[ -f $KW_BUILD_LOG_FILE ] || (echo "Build log file not found. Expected to be in: $KW_BUILD_LOG_FILE." ; exit 1;)

mkdir -p $CI_PROJECT_DIR/klocwork
report_file=$CI_PROJECT_DIR/klocwork/report.log
echo "------------------" >> $report_file
echo "Report generated at: "$(date '+%d/%m/%Y %H:%M:%S') >> $report_file
echo "Project source code url: $CI_PROJECT_URL" >> $report_file
echo "Project source code sha: $CI_COMMIT_SHA" >> $report_file
echo "Klocwork server: http://$KW_SERVER_IP:$KW_SERVER_PORT" >> $report_file
echo "------------------" >> $report_file

echo -e "\n\n\n" >> $report_file

# Get all issues list and put to report file
column_list=".id, .code, .severity, .state, .status, .taxonomyName, .owner, .url, .file, .line"
echo "------------------" >> $report_file
echo "Issues list:" >> $report_file
echo "------------------" >> $report_file
echo $column_list | sed 's/\\t/ ,/g' | column -t -s, >> $report_file
echo "------------------" >> $report_file
curl -f --data "action=search&project=$KW_PROJECT_NAME&query=build:'$KW_BUILD_NAME'&user=$KW_USER&ltoken=$KW_LTOKEN" $KW_SERVER_API_URL | jq-linux64 "[${column_list}] | @tsv" | sed 's/\\t/|/g' | column -t -s'|' | cut -d'"' -f2 >> $report_file

echo -e "\n\n\n" >> $report_file

# Attach build log to report file
echo "------------------" >> $report_file
echo "Build & scan log:" >> $report_file
echo "------------------" >> $report_file
cat $KW_BUILD_LOG_FILE >> $report_file
11 changes: 11 additions & 0 deletions scripts/store_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -xe
## Copyright 2019-2021 Intel Corporation
## SPDX-License-Identifier: Apache-2.0

project_name=$1
build_id=$2
group_name=$3
files=$4
STORAGE_DIR=$STORAGE_PATH/$project_name/$build_id/$group_name/
mkdir -p $STORAGE_DIR
cp $files $STORAGE_DIR/

0 comments on commit a2b90bd

Please sign in to comment.