Debian Codegraph @

scripts/run-scan-build

raw symbols SCIP
1 #!/bin/sh
2 # Run clang's static analyzer (scan-build) and record its output in output-scan-build/
3
4 # Ensure the current directory is where this script is
5 cd "$(dirname -- "$0")" || exit $?
6
7 OUTPUTDIR="$(pwd)/output-scan-build"
8
9 # Display the commands which are run, and make sure they succeed
10 set -x -e
11
12 # Use a temporary directory as an installation directory, if $DESTDIR is not set
13 if [ -z "$DESTDIR" ] ; then
14 DESTDIR="$(mktemp --tmpdir -d scan-build-destdir-XXXXXXXXXX)"
15 fi
16
17 # Make sure to use the newly-installed libraries when running tests
18 export LD_LIBRARY_PATH="$DESTDIR/usr/lib:$DESTDIR/lib"
19 export PATH="$DESTDIR/usr/sbin:$DESTDIR/usr/bin:$DESTDIR/sbin:$DESTDIR/bin:$PATH"
20 export PYTHONPATH="$DESTDIR$(${PYTHON:-python3} -c "from distutils.sysconfig import *;print(get_python_lib(prefix='/usr'))")"
21 export RUBYLIB="$DESTDIR/$(${RUBY:-ruby} -e 'puts RbConfig::CONFIG["vendorlibdir"]'):$DESTDIR/$(${RUBY:-ruby} -e 'puts RbConfig::CONFIG["vendorarchdir"]')"
22
23 # Build and analyze
24 make -C .. CC=clang clean distclean -j"$(nproc)"
25 scan-build -analyze-headers -o "$OUTPUTDIR" make -C .. CC=clang DESTDIR="$DESTDIR" install install-pywrap install-rubywrap all test
26
27 # Reduce the verbosity in order to keep the message from scan-build saying
28 # "scan-build: Run 'scan-view /.../output-scan-build/2018-...' to examine bug reports.
29 set +x
30
31 # Remove the destination directory without using "rm -rf"
32 chmod u+w "$DESTDIR/usr/bin/newrole"
33 rm -r "$DESTDIR"