extras/buildbot-checker.sh
changeset 1684 eb8b181d8301
parent 1425 176efd35457c
child 1685 12063a77c51d
equal deleted inserted replaced
1683:89e8d39420cd 1684:eb8b181d8301
    20 if [ ! -d "$CHECKERDIR" ]; then
    20 if [ ! -d "$CHECKERDIR" ]; then
    21     echo "$CHECKERDIR not found. Giving up." 1>&2
    21     echo "$CHECKERDIR not found. Giving up." 1>&2
    22     exit 1
    22     exit 1
    23 fi
    23 fi
    24 
    24 
    25 if [ -z "$MAKE" ]; then
       
    26     OSTYPE=`uname -s`
       
    27     if [ "$OSTYPE" == "Linux" ]; then
       
    28         NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
       
    29         let NCPU=$NCPU+1
       
    30     elif [ "$OSTYPE" = "Darwin" ]; then
       
    31         NCPU=`sysctl -n hw.ncpu`
       
    32     elif [ "$OSTYPE" = "SunOS" ]; then
       
    33         NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
       
    34     else
       
    35         NCPU=1
       
    36     fi
       
    37 
       
    38     if [ -z "$NCPU" ]; then
       
    39         NCPU=1
       
    40     elif [ "$NCPU" = "0" ]; then
       
    41         NCPU=1
       
    42     fi
       
    43 
       
    44     MAKE="make -j$NCPU"
       
    45 fi
       
    46 
       
    47 echo "\$MAKE is '$MAKE'"
       
    48 MAKECMD="$MAKE"
       
    49 unset MAKE  # prevent warnings about jobserver mode.
       
    50 
       
    51 set -x
    25 set -x
    52 set -e
    26 set -e
    53 
    27 
    54 cd `dirname "$0"`
    28 cd `dirname "$0"`
    55 cd ..
    29 cd ..
    64 
    38 
    65 # We turn off deprecated declarations, because we don't care about these warnings during static analysis.
    39 # We turn off deprecated declarations, because we don't care about these warnings during static analysis.
    66 # The -Wno-liblto is new since our checker-279 upgrade, I think; checker otherwise warns "libLTO.dylib relative to clang installed dir not found"
    40 # The -Wno-liblto is new since our checker-279 upgrade, I think; checker otherwise warns "libLTO.dylib relative to clang installed dir not found"
    67 
    41 
    68 # You might want to do this for CMake-backed builds instead...
    42 # You might want to do this for CMake-backed builds instead...
    69 PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis cmake -Wno-dev -DPHYSFS_BUILD_SHARED=False -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_EXE_LINKER_FLAGS="-Wno-liblto" ..
    43 PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis cmake -G Ninja -Wno-dev -DPHYSFS_BUILD_SHARED=False -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_EXE_LINKER_FLAGS="-Wno-liblto" ..
    70 
    44 
    71 # ...or run configure without the scan-build wrapper...
    45 # ...or run configure without the scan-build wrapper...
    72 #CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0 -Wno-deprecated-declarations" LDFLAGS="-Wno-liblto" ../configure --enable-assertions=enabled
    46 #CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0 -Wno-deprecated-declarations" LDFLAGS="-Wno-liblto" ../configure --enable-assertions=enabled
    73 
    47 
    74 rm -rf analysis
    48 rm -rf analysis
    75 PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis $MAKECMD
    49 PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis cmake --build . --config Debug
    76 
    50 
    77 if [ `ls -A analysis |wc -l` == 0 ] ; then
    51 if [ `ls -A analysis |wc -l` == 0 ] ; then
    78     mkdir analysis/zarro
    52     mkdir analysis/zarro
    79     echo '<html><head><title>Zarro boogs</title></head><body>Static analysis: no issues to report.</body></html>' >analysis/zarro/index.html
    53     echo '<html><head><title>Zarro boogs</title></head><body>Static analysis: no issues to report.</body></html>' >analysis/zarro/index.html
    80 fi
    54 fi