source: rtems-testing/coverity/do_coverity @ 003a4b1

4.11
Last change on this file since 003a4b1 was 003a4b1, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 16, 2010 at 6:35:13 PM

2010-06-16 Joel Sherrill <joel.sherrilL@…>

  • do_coverity: Fix typo.
  • do_mail_coverity: .com.com -> .com
  • Property mode set to 100755
File size: 3.8 KB
Line 
1#! /bin/sh
2#
3#  This script automates running Coverity on RTEMS and submitting
4#  the results.
5#
6#       + Instructions: http://scan.coverity.com/self-build/
7#       + Results:      http://scan2.coverity.com:9104/
8#
9#  You have to have an account to view the results
10#
11# NOTE:
12#    + You have to be joel to run and submit official results.
13#    + build.raw is very important if something goes wrong
14#
15#  $Id$
16#
17
18#
19# TODO:
20#   + parse arguments for some of the hard-coded items.
21#   + better instructions on setup. Where to download, etc.
22#
23
24RTEMS_BIN=/opt/rtems-4.11/bin
25COVERITY=${HOME}/prevent-linux-2.4.6
26RTEMS_TARGET=sparc-rtems4.11
27RTEMS_BSP=sis
28#RTEMS_TARGET=i386-rtems4.11
29#RTEMS_BSP=pc386
30
31do_mail="yes"
32
33#
34#  Checks the status returned by executables and exits if it is non-zero.
35#
36check_fatal()
37{
38  if [ $1 -ne 0 ] ; then
39    shift
40    echo "ERROR: $*" >&2
41    exit 1
42  fi
43}
44
45type ${RTEMS_TARGET}-gcc
46check_fatal $? "gcc not in path"
47
48test -d ${COVERITY}
49check_fatal $? "Coverity path not right"
50
51test -d ${COVERITY}/bin
52check_fatal $? "${COVERITY}/bin does not exist"
53
54test ${LOGNAME} = "joel"
55check_fatal $? "For now, Coverity must be run by joel"
56
57# Prepend Coverity to our PATH
58export PATH=${COVERITY}/bin:$PATH
59
60# Configure Coverity for this target compiler
61rm -rf ${COVERITY}/config/coverity_config.xml
62rm -rf ${COVERITY}/config/gcc-config-? ${COVERITY}/config/g++-config-?
63
64cov-configure -co ${RTEMS_BIN}/${RTEMS_TARGET}-gcc
65check_fatal $? "could not coverity configure GCC"
66cov-configure -co ${RTEMS_BIN}/${RTEMS_TARGET}-g++
67check_fatal $? "could not coverity configure g++"
68
69# Clean build directory and start over
70rm     -rf  b-coverity-${RTEMS_TARGET}
71check_fatal $? "Could not remove build directory"
72mkdir  -p   b-coverity-${RTEMS_TARGET}/b-${RTEMS_TARGET}
73check_fatal $? "Could not make build directory"
74cd          b-coverity-${RTEMS_TARGET}/b-${RTEMS_TARGET}
75check_fatal $? "Could not cd to build directory"
76
77# Configure RTEMS
78$r/configure --target=${RTEMS_TARGET} --enable-multilib \
79  --disable-networking --disable-itron --disable-tests \
80  --enable-rtemsbsp=${RTEMS_BSP} >c.log 2>&1
81check_fatal $? "could not configure RTEMS"
82
83# Build RTEMS
84cov-build -e emit -o output make -C ${RTEMS_TARGET}/cpukit >b.log 2>&1
85check_fatal $? "could not make RTEMS"
86
87# Did we have problems loading the Coverity dynamic library?
88grep -i "ERROR: ld.so:.*" b.log >/dev/null
89if [ $? -ne 1 ] ; then
90  check_fatal 1 "Looks like you have dynamic library issues with Coverity."
91fi
92
93# Did Coverity report something bad?
94grep -i cata output/build.raw >/dev/null
95if [ $? -ne 1 ] ; then
96  check_fatal 1 "Catastrophic failures reported by coverity."
97fi
98
99# Did Coverity report that it had no results?
100grep -i "No files were emitted" output/build.raw >/dev/null
101if [ $? -ne 1 ] ; then
102  check_fatal 1 "No output from Coverity.  Something went wrong."
103fi
104
105# Construct the README that is needed in project.tgz
106cat <<EOF >README
107Joel Sherrill
108joel.sherrill@gmail.com
109RTEMS
110EOF
111
112# Now create the tar file that Coverity wants
113tar czvf project.tgz README emit output
114check_fatal $? "could not make project.tgz"
115
116# If running inside OAR and RTEMS lab, then you will be able to
117# copy the results file to the ftp site and submit it to Coverity.
118if [ ${do_mail} = "yes" ] ; then
119  if [ -d /home/ftp/private/coverity ] ; then
120    echo "Placing project.tgz on RTEMS ftp site."
121    cp project.tgz /home/ftp/private/coverity/
122    echo "Emailing analysis request to Coverity."
123    do_mail_coverity
124  else
125    # There are unfortunately some by hand steps
126    cat <<EOF
127You do not have NFS access to the RTEMS.org ftp site. So you will have
128to copy the project.tgz and email Coverity by hand.
129 
130(1) scp */project.tgz joel@www.rtems.org:/home/ftp/private/coverity/
131
132(2) Send email to Coverity to request a run. (e.g. do_mail_coverity)
133EOF
134  fi
135fi
136
137# Ran completed OK
138exit 0
Note: See TracBrowser for help on using the repository browser.