Ignore:
Timestamp:
Feb 23, 2006, 12:03:58 AM (19 years ago)
Author:
rainer
Message:

Minor code revisions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/testcompile.sh

    r19 r22  
    11#! /bin/sh
    22
    3 MAXTEST=28; export MAXTEST
     3MAXTEST=56; export MAXTEST
     4
     5run_smatch ()
     6{
     7    export CDIR=`pwd`;
     8
     9    if [ -z "$doall" ]; then
     10        [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (smatch)";
     11        return 0
     12    fi
     13
     14    if [ "x$3" = "xdebug" ]; then memcheck=debug; else memcheck=simple; fi
     15    if [ -f ../sm_scripts/smatch.pm ]; then
     16        (
     17            cd ../sm_scripts;
     18           
     19            for i in ${CDIR}/*.c.sm ; do
     20                # echo $i;
     21                cat $i | ./unreached_code.pl;
     22                cat $i | ./ampersand_missing.sh;
     23                cat $i | ./uninitialized.pl;
     24                cat $i | ./eqeq.pl;
     25                cat $i | ./for_bounds.pl;
     26                cat $i | ./unchecked_returns.pl;
     27                cat $i | ./unreached_code.pl;
     28                cat $i | ./uninitialized.pl;
     29                # from http://people.redhat.com/mstefani/wine/smatch/
     30                if [ -f ./while_for_check.pl ]; then
     31                    cat $i | ./while_for_check.pl;
     32                fi
     33                # --> end wine <--
     34                # samhain specific
     35                if [ $memcheck = xsimple ]; then
     36                    if [ -f ./samhain_unfree.pl ]; then
     37                        cat $i | ./samhain_unfree.pl | \
     38                            egrep -v 'x_cutest_.*Test_' | \
     39                            egrep -v 'x_sh_unix.c .... .... sh_unix_copyenv';
     40                    fi
     41                fi
     42                if [ $memcheck = xdebug ]; then
     43                    if [ -f ./samhain_unfree_debug.pl ]; then
     44                        cat $i | ./samhain_unfree_debug.pl | \
     45                            egrep -v 'x_cutest_.*Test_' | \
     46                            egrep -v 'x_sh_unix.c .... .... sh_unix_copyenv';
     47                    fi
     48                fi
     49                # --> end samhain specific <--
     50                #cat $i | ./unfree.pl | \
     51                #    egrep -v 'x_cutest_.*Test_' | \
     52                #    grep -v 'x_sh_unix.c .... .... sh_unix_copyenv';
     53                touch list_null_funcs_uniq;
     54                cat $i | ./deference_check.pl;
     55                rm -f list_null_funcs_uniq;
     56                rm -f $i
     57            done
     58        ) >test_log_smatch 2>&1
     59        if [ -f test_log_smatch ]; then
     60            lines=`cat test_log_smatch | wc -l`
     61            if [ $lines -ne 0 ]; then
     62                cat test_log_smatch
     63                rm -f test_log_smatch
     64                [ -z "$quiet" ] && log_fail $2 ${MAXTEST} "$TEST (smatch)";
     65                return 1
     66            fi
     67        fi
     68        [ -z "$quiet" ] && log_ok $2 ${MAXTEST} "$TEST (smatch)";
     69        return 0
     70    fi
     71    [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (smatch)";
     72    return 0
     73}
    474
    575testmake ()
     
    878        if test x$1 = x0; then
    979                [ -z "$verbose" ]     ||  log_msg_ok  "configure...  $TEST";
    10                 $MAKE cutest > /dev/null 2>> test_log
     80                $MAKE ${SMATCH} cutest > /dev/null 2>> test_log
    1181                if test x$? = x0; then
    1282                    [ -z "$verbose" ] || log_msg_ok   "make cutest... $TEST";
     
    34104        log_start "COMPILE"
    35105
     106        if [ -f /usr/local/gcc-smatch/bin/gcc ]; then
     107            SAVE_CC="${CC}"
     108            SMATCH="DBGDEF=--smatch"; export SMATCH
     109            CC="/usr/local/gcc-smatch/bin/gcc"; export CC
     110        fi
     111
    36112        num=0
    37113        numfail=0
     
    40116        # test standalone compilation
    41117        #
    42         TEST="${S}standalone agent w/suidcheck${E}"
     118        TEST="${S}standalone w/suidcheck${E}"
    43119        #
    44120        if test -r "Makefile"; then
     
    50126        let "num = num + 1" >/dev/null
    51127        testmake $? $num || let "numfail = numfail + 1"  >/dev/null
     128        let "num = num + 1" >/dev/null
     129        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    52130
    53131        #
    54132        # test standalone compilation
    55133        #
    56         TEST="${S}standalone agent w/mounts-check and w/userfiles${E}"
     134        TEST="${S}standalone w/mounts-check w/userfiles${E}"
    57135        #
    58136        if test -r "Makefile"; then
     
    64142        let "num = num + 1" >/dev/null
    65143        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     144        let "num = num + 1" >/dev/null
     145        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    66146
    67147
     
    69149        # test standalone compilation
    70150        #
    71         TEST="${S}standalone agent w/timeserver and w/message-queue${E}"
     151        TEST="${S}standalone w/timeserver and w/msgqueue${E}"
    72152        #
    73153        if test -r "Makefile"; then
     
    79159        let "num = num + 1" >/dev/null
    80160        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     161        let "num = num + 1" >/dev/null
     162        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    81163
    82164        #
    83165        # test standalone compilation with --with-nocl=PW
    84166        #
    85         TEST="${S}standalone agent w/nocl${E}"
     167        TEST="${S}standalone w/nocl${E}"
    86168        #
    87169        if test -r "Makefile"; then
     
    93175        let "num = num + 1" >/dev/null
    94176        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     177        let "num = num + 1" >/dev/null
     178        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    95179
    96180        #
    97181        # test standalone compilation w/ debug
    98182        #
    99         TEST="${S}standalone agent w/debug${E}"
     183        TEST="${S}standalone w/debug${E}"
    100184        #
    101185        if test -r "Makefile"; then
     
    107191        let "num = num + 1" >/dev/null
    108192        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     193        let "num = num + 1" >/dev/null
     194        run_smatch $? $num debug || let "numfail = numfail + 1"  >/dev/null
    109195
    110196        #
    111197        # test standalone compilation w/ gpg
    112198        #
    113         TEST="${S}standalone agent w/gpg${E}"
     199        TEST="${S}standalone w/gpg${E}"
    114200        #
    115201        GPG=`find_path gpg`
     
    126212            #
    127213            testmake $? $num || let "numfail = numfail + 1" >/dev/null
     214            let "num = num + 1" >/dev/null
     215            run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    128216        fi
    129217
     
    131219        # test standalone compilation w/stealth
    132220        #
    133         TEST="${S}standalone agent w/stealth${E}"
     221        TEST="${S}standalone w/stealth${E}"
    134222        #
    135223        if test -r "Makefile"; then
     
    141229        let "num = num + 1" >/dev/null
    142230        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     231        let "num = num + 1" >/dev/null
     232        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    143233
    144234        #
    145235        # test standalone compilation w/logwatch
    146236        #
    147         TEST="${S}standalone agent w/login-watch${E}"
     237        TEST="${S}standalone w/login-watch${E}"
    148238        #
    149239        if test -r "Makefile"; then
     
    155245        let "num = num + 1" >/dev/null
    156246        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     247        let "num = num + 1" >/dev/null
     248        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    157249
    158250        #
    159251        # test standalone compilation w/mysql
    160252        #
    161         TEST="${S}standalone agent w/mysql${E}"
     253        TEST="${S}standalone w/mysql${E}"
    162254        #
    163255        if test -r "Makefile"; then
     
    169261        let "num = num + 1" >/dev/null
    170262        testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null
     263        let "num = num + 1" >/dev/null
     264        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    171265
    172266        #
    173267        # test standalone compilation w/postgresql
    174268        #
    175         TEST="${S}standalone agent w/postgresql${E}"
     269        TEST="${S}standalone w/postgresql${E}"
    176270        #
    177271        if test -r "Makefile"; then
     
    183277        let "num = num + 1" >/dev/null
    184278        testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null
     279        let "num = num + 1" >/dev/null
     280        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    185281
    186282        #
    187283        # test standalone compilation
    188284        #
    189         TEST="${S}standalone agent w/o mail${E}"
     285        TEST="${S}standalone w/o mail${E}"
    190286        #
    191287        if test -r "Makefile"; then
     
    197293        let "num = num + 1" >/dev/null
    198294        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     295        let "num = num + 1" >/dev/null
     296        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    199297
    200298        #
    201299        # test standalone compilation
    202300        #
    203         TEST="${S}standalone agent w/o external scripts${E}"
     301        TEST="${S}standalone w/o external${E}"
    204302        #
    205303        if test -r "Makefile"; then
     
    211309        let "num = num + 1" >/dev/null
    212310        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     311        let "num = num + 1" >/dev/null
     312        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    213313
    214314        # echo; echo "${S}__ TEST CLIENT/SERVER __${E}"; echo;
     
    227327        let "num = num + 1" >/dev/null
    228328        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     329        let "num = num + 1" >/dev/null
     330        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    229331       
    230332        if test -r "Makefile"; then
     
    236338        let "num = num + 1" >/dev/null
    237339        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     340        let "num = num + 1" >/dev/null
     341        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    238342
    239343        #
     
    257361            #
    258362            testmake $? $num || let "numfail = numfail + 1" >/dev/null
     363            let "num = num + 1" >/dev/null
     364            run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    259365            #
    260366            if test -r "Makefile"; then
     
    266372            let "num = num + 1" >/dev/null
    267373            testmake $? $num || let "numfail = numfail + 1" >/dev/null
     374            let "num = num + 1" >/dev/null
     375            run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    268376        fi
    269377
     
    282390        let "num = num + 1" >/dev/null
    283391        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     392        let "num = num + 1" >/dev/null
     393        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    284394        #
    285395        if test -r "Makefile"; then
     
    291401        let "num = num + 1" >/dev/null
    292402        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     403        let "num = num + 1" >/dev/null
     404        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    293405
    294406        #
     
    305417        let "num = num + 1" >/dev/null
    306418        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     419        let "num = num + 1" >/dev/null
     420        run_smatch $? $num debug || let "numfail = numfail + 1"  >/dev/null
    307421        #
    308422        if test -r "Makefile"; then
     
    314428        let "num = num + 1" >/dev/null
    315429        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     430        let "num = num + 1" >/dev/null
     431        run_smatch $? $num debug || let "numfail = numfail + 1"  >/dev/null
    316432
    317433        #
     
    328444        let "num = num + 1" >/dev/null
    329445        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     446        let "num = num + 1" >/dev/null
     447        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    330448        #
    331449        if test -r "Makefile"; then
     
    337455        let "num = num + 1" >/dev/null
    338456        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     457        let "num = num + 1" >/dev/null
     458        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    339459
    340460        #
     
    351471        let "num = num + 1" >/dev/null
    352472        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     473        let "num = num + 1" >/dev/null
     474        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    353475        #
    354476        if test -r "Makefile"; then
     
    360482        let "num = num + 1" >/dev/null
    361483        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     484        let "num = num + 1" >/dev/null
     485        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    362486
    363487        #
     
    374498        let "num = num + 1" >/dev/null
    375499        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     500        let "num = num + 1" >/dev/null
     501        run_smatch $? $num debug || let "numfail = numfail + 1"  >/dev/null
    376502        #
    377503        if test -r "Makefile"; then
     
    383509        let "num = num + 1" >/dev/null
    384510        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     511        let "num = num + 1" >/dev/null
     512        run_smatch $? $num debug || let "numfail = numfail + 1"  >/dev/null
    385513
    386514        #
    387515        # test client/server compilation
    388516        #
    389         TEST="${S}client/server application w/o external scripts${E}"
     517        TEST="${S}client/server application w/o external${E}"
    390518        #
    391519        if test -r "Makefile"; then
     
    397525        let "num = num + 1" >/dev/null
    398526        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     527        let "num = num + 1" >/dev/null
     528        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
    399529        #
    400530        if test -r "Makefile"; then
     
    406536        let "num = num + 1" >/dev/null
    407537        testmake $? $num || let "numfail = numfail + 1" >/dev/null
     538        let "num = num + 1" >/dev/null
     539        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
     540
     541        [ -z "${SMATCH}" ] || { CC="${SAVE_CC}"; export CC; }
    408542
    409543        log_end "COMPILE"
Note: See TracChangeset for help on using the changeset viewer.