1#! /bin/sh
2
3# check if we use the correct directory
4ls src/civetweb.c
5if [ "$?" = "0" ]; then
6	echo "Building files for coverity check ..."
7else
8	echo "Run this script from the root directory of project!" 1>&2
9	echo "username@hostname:/somewhere/civetweb$ ./resources/coverity_check.sh" 1>&2
10	exit 1
11fi
12
13# remove last build
14rm -rf cov_build/
15
16# copy files to build folder
17mkdir cov_build
18mkdir cov_build/src
19mkdir cov_build/include
20mkdir cov_build/resources
21
22cp Makefile cov_build/
23cp src/civetweb.c cov_build/src/
24cp src/main.c cov_build/src/
25cp src/md5.inl cov_build/src/
26cp src/sha1.inl cov_build/src/
27cp src/handle_form.inl cov_build/src/
28cp include/civetweb.h cov_build/include/
29cp resources/Makefile.in-os cov_build/resources/
30
31cd cov_build
32
33# new scan build
34../../cov-analysis-linux64-2017.07/bin/cov-build  --dir cov-int make WITH_IPV6=1 WITH_WEBSOCKET=1 WITH_SERVER_STATS=1 WITH_EXPERIMENTAL=1
35
36
37# pack build results for upload
38tar czvf civetweb_coverity_check.tgz cov-int
39
40cd ..
41
42# check if the build was successful
43echo
44ls -la cov_build/civetweb_coverity_check.tgz
45
46if [ "$?" = "0" ]; then
47	echo "... done"
48	echo
49        echo "submit to https://scan.coverity.com/projects/bel2125-civetweb"
50	echo
51	echo "last commit was"
52	git log -n 1
53        echo
54        echo
55else
56	echo "No civetweb_coverity_check.tgz file" 1>&2
57        echo
58	exit 1
59fi
60
61# return "ok"
62exit 0
63
64