blob: 72616f9e9d4406f5d006910f5ec1d82ad5dcc1da (
plain)
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
|
#! /bin/sh
t=__wt.$$
trap 'rm -rf $t' 0 1 2 3 13 15
set -e
# Find the top-level WiredTiger directory and move to there.
top=`git rev-parse --show-toplevel` && cd $top || exit 1
echo "$0: running scan-build in $PWD"
# Clang isn't installed in any standard place, find a binary we can use.
# If the caller gives us $SCANBUILD, check for $SCANCOMPILER and default
# to "clang".
scan="$SCANBUILD"
test -z "$scan" || compiler="${SCANCOMPILER:-clang}"
if test -z "$scan" &&
test -x /usr/bin/clang &&
test -x /usr/lib/llvm-3.9/bin/scan-build; then
compiler="/usr/bin/clang"
scan="/usr/lib/llvm-3.9/bin/scan-build"
fi
if test -z "$scan"; then
echo "$0: no clang compiler and scan-build programs found"
echo "$0: set \$SCANCOMPILER=/path/clang and \$SCANBUILD=/path/scan-build to continue"
exit 1
fi
echo "$0: compiler: $compiler"
echo "$0: scan-build: $scan"
# Remove old reports.
rm -rf clangScanBuildReports && mkdir clangScanBuildReports
sh autogen.sh > /dev/null || exit 1
args="-o clangScanBuildReports"
args="$args --use-cc=$compiler"
args="$args -disable-checker core.NullDereference"
$scan $args ./configure 'CFLAGS=-g' \
--disable-shared --enable-diagnostic --enable-strict > /dev/null
$scan $args make -j 8 wt 1>/dev/null 2>$t
make -j 8 distclean > /dev/null
grep 'No bugs found' $t > /dev/null && exit 0
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
echo 'scan-build output:'
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
cat $t
exit 1
|