forked from Xilinx/XRT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcovbuild.sh
executable file
·80 lines (70 loc) · 1.77 KB
/
covbuild.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
set -e
OSDIST=`lsb_release -i |awk -F: '{print tolower($2)}' | tr -d ' \t'`
BUILDDIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
CORE=`grep -c ^processor /proc/cpuinfo`
CMAKE=cmake
COVBIN=/home/soeren/tools/coverity/cov-analysis-linux64-2017.07/bin
if [[ $OSDIST == "centos" ]]; then
CMAKE=cmake3
if [[ ! -x "$(command -v $CMAKE)" ]]; then
echo "$CMAKE is not installed, please run xrtdeps.sh"
exit 1
fi
fi
if [[ $(git branch | grep '*' | cut -d ' ' -f2) != "2018.3" ]]; then
echo "Currently only analyzing 2018.3"
echo "covbuild.sh must be run on branch 2018.3"
exit
fi
usage()
{
echo "Usage: cov.sh [options]"
echo
echo "[-help] List this help"
echo "[clean|-clean] Remove build directories"
exit 1
}
clean=0
ccache=1
while [ $# -gt 0 ]; do
case "$1" in
-help)
usage
;;
clean|-clean)
clean=1
shift
;;
*)
echo "unknown option"
usage
;;
esac
done
here=$PWD
cd $BUILDDIR
if [ $clean == 1 ]; then
echo $PWD
echo "/bin/rm -rf coverity"
/bin/rm -rf coverity
exit 0
fi
mkdir -p coverity
cd coverity
/bin/rm -f xrt.tgz
imed=$PWD/cov-int
$CMAKE -DCMAKE_BUILD_TYPE=Release ../../src
$COVBIN/cov-build --dir $imed make -j4
make DESTDIR=$PWD install
cd usr/src/xrt-2.1.0/driver/xclng/drm/xocl
$COVBIN/cov-build --dir $imed make
cd $BUILDDIR/coverity
tar czvf xrt.tgz cov-int
cd $here
if [[ -e $BUILDDIR/coverity/xrt.tgz ]]; then
echo "Coverity build completed, make sure it was successful, then upload xrt.tgz to scan.coverity.com"
echo "file: $BUILDDIR/coverity/xrt.tgz"
echo "Project Version: 2.1.0"
echo "Description/tag: $(git rev-parse HEAD)"
fi