-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcovbuild.sh
executable file
·56 lines (49 loc) · 1.19 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
#!/usr/bin/env bash
# Settings
PROJECT_NAME=pokepon
EMAIL=silverweed1991@gmail.com
COVERITY_PATH=$HOME/Public/cov-analysis-linux64-7.6.0/bin
###########
getbuild() {
git describe --always --long --dirty
}
getreadiness() {
tail cov-int/build-log.txt | grep compilation | cut -f2 -d\( | cut -f1 -d%
}
PATH=$PATH:$COVERITY_PATH
make clean
rm -f ${PROJECT_NAME}.tgz
if (cov-build --dir cov-int make -j); then
tar cvfz ${PROJECT_NAME}.tgz cov-int
fi
if [[ $? == 0 ]]; then
R=$(getreadiness)
if ((R < 85)); then
echo "[ ERROR ] only ${R}% compilation units are ready: build will fail."
exit 2
else
echo "[ OK ] ${R}% of the compilation units are ready."
fi
echo "Submit new build? ($(du -sh ${PROJECT_NAME}.tgz | cut -f1))"
select ANS in "Submit" "Abort"; do
case $ANS in
Submit)
echo Submitting... >&2
set -x
curl --form token=$(< ./cov-token) \
--form email=$EMAIL \
--form file=@./${PROJECT_NAME}.tgz \
--form version="0.0" \
--form description="${PROJECT_NAME} build rev.$(getbuild)" \
https://scan.coverity.com/builds?project=${PROJECT_NAME}
set +x
echo Done. >&2
exit 0
;;
*)
echo Aborted. >&2
exit 1
;;
esac
done
fi