sdl

FORK: Simple Directmedia Layer
git clone https://git.neptards.moe/neptards/sdl.git
Log | Files | Refs

checker-buildbot.sh (1998B)


      1 #!/bin/bash
      2 
      3 # This is a script used by some Buildbot buildslaves to push the project
      4 #  through Clang's static analyzer and prepare the output to be uploaded
      5 #  back to the buildmaster. You might find it useful too.
      6 
      7 # Install Clang (you already have it on Mac OS X, apt-get install clang
      8 #  on Ubuntu, etc), and make sure scan-build is in your $PATH.
      9 
     10 FINALDIR="$1"
     11 
     12 set -x
     13 set -e
     14 
     15 cd `dirname "$0"`
     16 cd ..
     17 
     18 rm -rf checker-buildbot analysis
     19 if [ ! -z "$FINALDIR" ]; then
     20     rm -rf "$FINALDIR"
     21 fi
     22 
     23 mkdir checker-buildbot
     24 cd checker-buildbot
     25 
     26 # We turn off deprecated declarations, because we don't care about these warnings during static analysis.
     27 # The -Wno-liblto is new since our checker-279 upgrade, I think; checker otherwise warns "libLTO.dylib relative to clang installed dir not found"
     28 
     29 # You might want to do this for CMake-backed builds instead...
     30 scan-build -o analysis cmake -G Ninja -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_SHARED_LINKER_FLAGS="-Wno-liblto" ..
     31 
     32 # ...or run configure without the scan-build wrapper...
     33 #CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0 -Wno-deprecated-declarations" LDFLAGS="-Wno-liblto" ../configure --enable-assertions=enabled
     34 
     35 rm -rf analysis
     36 scan-build -o analysis ninja
     37 
     38 if [ `ls -A analysis |wc -l` == 0 ] ; then
     39     mkdir analysis/zarro
     40     echo '<html><head><title>Zarro boogs</title></head><body>Static analysis: no issues to report.</body></html>' >analysis/zarro/index.html
     41 fi
     42 
     43 mv analysis/* ../analysis
     44 rmdir analysis   # Make sure this is empty.
     45 cd ..
     46 chmod -R a+r analysis
     47 chmod -R go-w analysis
     48 find analysis -type d -exec chmod a+x {} \;
     49 if [ -x /usr/bin/xattr ]; then find analysis -exec /usr/bin/xattr -d com.apple.quarantine {} \; 2>/dev/null ; fi
     50 
     51 if [ ! -z "$FINALDIR" ]; then
     52     mv analysis "$FINALDIR"
     53 else
     54     FINALDIR=analysis
     55 fi
     56 
     57 rm -rf checker-buildbot
     58 
     59 echo "Done. Final output is in '$FINALDIR' ..."
     60 
     61 # end of checker-buildbot.sh ...
     62