apply_return_fixes.sh: exit with success
[smatch.git] / smatch_scripts / build_kernel_data.sh
blob87f1f0639c55fa67c325ac7cdbc9cc44be75adaf
1 #!/bin/bash
3 set -e
5 PROJECT=kernel
7 function usage {
8 echo
9 echo "Usage: $0"
10 echo "Updates the smatch_data/ directory and builds the smatch database"
11 echo
12 exit 1
15 if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
16 usage;
19 SCRIPT_DIR=$(dirname $0)
20 if [ -e $SCRIPT_DIR/../smatch -a -d kernel -a -d fs ] ; then
21 CMD=$SCRIPT_DIR/../smatch
22 DATA_DIR=$SCRIPT_DIR/../smatch_data
23 else
24 echo "This script should be located in the smatch_scripts/ subdirectory of the smatch source."
25 echo "It should be run from the root of a kernel source tree."
26 exit 1
29 # If someone is building the database for the first time then make sure all the
30 # required packages are installed
31 if [ ! -e smatch_db.sqlite ] ; then
32 [ -e smatch_warns.txt ] || touch smatch_warns.txt
33 if ! $DATA_DIR/db/create_db.sh -p=kernel smatch_warns.txt ; then
34 echo "Hm... Not working. Make sure you have all the sqlite3 packages"
35 echo "And the sqlite3 libraries for Perl and Python"
36 exit 1
40 BUILD_STATUS=0
41 $SCRIPT_DIR/test_kernel.sh --call-tree --info --spammy --data=$DATA_DIR || BUILD_STATUS=$?
42 echo "smatch_warns.txt built."
44 for i in $SCRIPT_DIR/gen_* ; do
45 $i smatch_warns.txt -p=kernel
46 done
48 mv ${PROJECT}.* $DATA_DIR
50 $DATA_DIR/db/create_db.sh -p=kernel smatch_warns.txt
52 exit $BUILD_STATUS