1#!/bin/bash
2
3
4# Copyright (c) 2013 Lawrence Livermore National Laboratory
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License version 2 as
8# published by the Free Software Foundation;
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18#
19# Author: Peter D. Barnes, Jr. <pdbarnes@llnl.gov>
20
21#
22#  Do a coverity build and submit report
23#
24
25me=`basename $0`
26
27# echo commands and output to a log file
28
29logf=coverity/coverity-build.log
30echo | tee $logf
31
32function say ()
33{
34    echo "$me:" $* | tee -a $logf
35}
36blank ()
37{
38    echo | tee -a $logf
39}
40function doo ()
41{
42    say "$ "$*
43    $* 2>&1 | tee -a $logf
44}
45
46
47
48
49say $(date)
50blank
51
52doo ./waf clean
53blank
54
55doo ./waf configure $NS3CONFIG
56blank
57
58cov=coverity/cov-int
59doo cov-build --dir $cov ./waf build
60blank
61
62tarf=coverity/ns-3.tgz
63doo tar cvzf $tarf -C coverity cov-int
64blank
65
66useremail=$(hg showconfig ui.username | \
67    egrep -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b")
68
69repoversion="$(basename $(dirname $PWD))@$(hg id -i)"
70
71# curl complains if this contains white space
72description="Coverity-mods"
73
74doo curl \
75     --form file=@$tarf \
76     --form project=ns-3 \
77     --form password=4jk2BVX9 \
78     --form email="$useremail" \
79     --form version="$repoversion" \
80     --form description="$description" \
81     http://scan5.coverity.com/cgi-bin/upload.py
82blank
83
84say $(date)
85blank
86