Changeset 474 for trunk/test
- Timestamp:
- May 30, 2015, 7:57:16 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/testcompile.sh
r473 r474 20 20 # 21 21 22 # dnmalloc + cppcheck + flawfinder + (38 * 2) 22 # dnmalloc + cppcheck + flawfinder + (38 * 2) - 8 23 23 MAXTEST=79; export MAXTEST 24 24 … … 85 85 run_cppcheck () 86 86 { 87 if [ -z "$doall" ]; then88 [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "check w/cppcheck";89 return 090 fi91 87 # 92 88 CPC=`find_path cppcheck` … … 124 120 } 125 121 126 run_ smatch()122 run_clang () 127 123 { 128 124 export CDIR=`pwd`; 129 125 130 126 if [ -z "$doall" ]; then 131 [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST ( smatch)";127 [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (clang)"; 132 128 return 0 133 129 fi 134 130 135 if [ ! -f "./x_samhain.c.sm" ]; then 136 [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (skip sm)"; 131 CLANGPATH=`find_path clang` 132 if [ -n "$CLANGPATH" ]; then 133 CLANG_CC="$CLANGPATH"; export CLANG_CC 134 else 135 [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (clang)"; 137 136 return 0 138 137 fi 139 138 140 if [ "x$3" = "xdebug" ]; then memcheck=debug; else memcheck=simple; fi 141 if [ -f ../../static/sm_scripts/smatch.pm ]; then 142 ( 143 cd ../../static/sm_scripts; 144 145 for i in ${CDIR}/*.c.sm ; do 146 # echo $i; 147 cat $i | ./unreached_code.pl | grep -v sh_threaded_module_run; 148 cat $i | ./ampersand_missing.sh; 149 cat $i | ./eqeq.pl; 150 cat $i | ./for_bounds.pl; # doesn't work? 151 cat $i | ./unchecked_returns.pl; 152 cat $i | ./uninitialized.pl; # doesn't work? 153 154 # from http://people.redhat.com/mstefani/wine/smatch/ 155 if [ -f ./while_for_check.pl ]; then 156 cat $i | ./while_for_check.pl; # works 157 fi 158 # --> end wine <-- 159 160 # samhain specific modifications (list of free/malloc funcs) 161 # doesn't seem to find anything useful 162 if [ $memcheck = xsimple ]; then 163 if [ -f ./samhain_unfree.pl ]; then 164 cat $i | ./samhain_unfree.pl | \ 165 egrep -v 'x_cutest_.*Test_' | \ 166 egrep -v 'x_sh_unix.c .... .... sh_unix_copyenv'; 167 fi 168 fi 169 if [ $memcheck = xdebug ]; then 170 if [ -f ./samhain_unfree_debug.pl ]; then 171 cat $i | ./samhain_unfree_debug.pl | \ 172 egrep -v 'x_cutest_.*Test_' | \ 173 egrep -v 'x_sh_unix.c .... .... sh_unix_copyenv'; 174 fi 175 fi 176 # --> end samhain specific <-- 177 178 echo malloc > list_null_funcs_uniq; 179 echo getenv >> list_null_funcs_uniq; 180 cat $i | ./deference_check.pl |\ 181 egrep -v 'x_trustfile.c ... ... sl_trustfile' | \ 182 egrep -v 'x_sh_mem.c '; 183 rm -f list_null_funcs_uniq; 184 # rm -f $i 185 done 186 ) >test_log_smatch 2>&1 187 if [ -f test_log_smatch ]; then 188 lines=`cat test_log_smatch | wc -l` 189 if [ $lines -ne 0 ]; then 190 cat test_log_smatch 191 rm -f test_log_smatch 192 [ -z "$quiet" ] && log_fail $2 ${MAXTEST} "$TEST (smatch)"; 193 return 1 194 fi 195 fi 196 [ -z "$quiet" ] && log_ok $2 ${MAXTEST} "$TEST (smatch)"; 197 return 0 198 fi 199 [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (smatch)"; 200 return 0 139 SAVE_TEST="$TEST" 140 TEST="$TEST (clang)" 141 testmake $1 $2 142 retval=$? 143 CLANG_CC=""; export CLANG_CC 144 TEST="$SAVE_TEST" 145 return $retval 201 146 } 202 147 203 148 testmake () 204 149 { 205 206 150 fail=0 207 151 # … … 219 163 [ -z "$verbose" ] || log_msg_ok "configure... $TEST"; 220 164 $MAKE clean > /dev/null 2>> test_log 221 $MAKE ${SMATCH} cutest > /dev/null 2>> test_log 165 if [ -z "$CLANG_CC" ]; then 166 $MAKE cutest > /dev/null 2>> test_log 167 else 168 sed --in-place 's/-Wno-empty-body/-Wno-empty-body -Wno-invalid-source-encoding/g' Makefile 169 sed --in-place 's/-fno-strength-reduce//g' Makefile 170 $MAKE -e CC=$CLANG_CC -e BUILD_CC=$CLANG_CC cutest > /dev/null 2>> test_log 171 fi 222 172 if test x$? = x0; then 223 173 [ -z "$verbose" ] || log_msg_ok "make cutest... $TEST"; … … 247 197 { 248 198 log_start "COMPILE" 249 250 if [ "x$doall" = xon ]; then251 uname -a | grep x86_64 >/dev/null252 if [ $? -ne 0 ]; then253 if [ -f /usr/local/gcc-smatch/bin/gcc ]; then # FIXME254 SAVE_CC="${CC}"255 SMATCH="DBGDEF=--smatch"; export SMATCH256 SAVE_SMATCH="${SMATCH}"; export SAVE_SMATCH257 CC="/usr/local/gcc-smatch/bin/gcc"; export CC258 SMATCH_CC="${CC}"259 fi260 fi261 fi262 199 263 200 num=0 … … 342 279 testmake $? $num || let "numfail = numfail + 1" >/dev/null 343 280 let "num = num + 1" >/dev/null 344 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null281 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 345 282 346 283 # … … 353 290 fi 354 291 # 355 [ -z "${SMATCH}" ] || { CC="${SAVE_CC}"; export CC; SMATCH=""; export SMATCH; }356 #357 292 ${TOP_SRCDIR}/configure --quiet --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test --enable-static --enable-suidcheck --enable-process-check ${C_LOGFILE} > /dev/null 2>> test_log 358 293 # … … 360 295 testmake $? $num || let "numfail = numfail + 1" >/dev/null 361 296 let "num = num + 1" >/dev/null 362 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 363 # 364 [ -z "${SMATCH_CC}" ] || { CC="${SMATCH_CC}"; export CC; SMATCH="${SAVE_SMATCH}"; export SMATCH; } 297 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 365 298 # 366 299 # test standalone compilation … … 377 310 testmake $? $num || let "numfail = numfail + 1" >/dev/null 378 311 let "num = num + 1" >/dev/null 379 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null312 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 380 313 381 314 # … … 388 321 fi 389 322 # 390 [ -z "${SMATCH}" ] || { CC="${SAVE_CC}"; export CC; SMATCH=""; export SMATCH; }391 #392 323 ${TOP_SRCDIR}/configure --quiet --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test --enable-process-check --enable-port-check --enable-static > /dev/null 2>> test_log 393 324 # … … 395 326 testmake $? $num || let "numfail = numfail + 1" >/dev/null 396 327 let "num = num + 1" >/dev/null 397 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 398 # 399 [ -z "${SMATCH_CC}" ] || { CC="${SMATCH_CC}"; export CC; SMATCH="${SAVE_SMATCH}"; export SMATCH; } 328 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 400 329 # 401 330 # test standalone compilation … … 412 341 testmake $? $num || let "numfail = numfail + 1" >/dev/null 413 342 let "num = num + 1" >/dev/null 414 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null343 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 415 344 416 345 # … … 428 357 testmake $? $num || let "numfail = numfail + 1" >/dev/null 429 358 let "num = num + 1" >/dev/null 430 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null359 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 431 360 432 361 … … 445 374 testmake $? $num || let "numfail = numfail + 1" >/dev/null 446 375 let "num = num + 1" >/dev/null 447 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null376 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 448 377 449 378 # … … 461 390 testmake $? $num || let "numfail = numfail + 1" >/dev/null 462 391 let "num = num + 1" >/dev/null 463 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null392 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 464 393 465 394 # … … 477 406 testmake $? $num || let "numfail = numfail + 1" >/dev/null 478 407 let "num = num + 1" >/dev/null 479 run_ smatch$? $num debug || let "numfail = numfail + 1" >/dev/null408 run_clang $? $num debug || let "numfail = numfail + 1" >/dev/null 480 409 481 410 # … … 500 429 testmake $? $num || let "numfail = numfail + 1" >/dev/null 501 430 let "num = num + 1" >/dev/null 502 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null431 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 503 432 fi 504 433 … … 517 446 testmake $? $num || let "numfail = numfail + 1" >/dev/null 518 447 let "num = num + 1" >/dev/null 519 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null448 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 520 449 521 450 # … … 533 462 testmake $? $num || let "numfail = numfail + 1" >/dev/null 534 463 let "num = num + 1" >/dev/null 535 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null464 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 536 465 537 466 # … … 549 478 testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null 550 479 let "num = num + 1" >/dev/null 551 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null480 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 552 481 553 482 # … … 565 494 testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null 566 495 let "num = num + 1" >/dev/null 567 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null496 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 568 497 569 498 # … … 581 510 testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null 582 511 let "num = num + 1" >/dev/null 583 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null512 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 584 513 585 514 # … … 597 526 testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null 598 527 let "num = num + 1" >/dev/null 599 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null528 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 600 529 601 530 # … … 613 542 testmake $? $num || let "numfail = numfail + 1" >/dev/null 614 543 let "num = num + 1" >/dev/null 615 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null544 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 616 545 617 546 # … … 629 558 testmake $? $num || let "numfail = numfail + 1" >/dev/null 630 559 let "num = num + 1" >/dev/null 631 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null560 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 632 561 633 562 # echo; echo "${S}__ TEST CLIENT/SERVER __${E}"; echo; … … 647 576 testmake $? $num || let "numfail = numfail + 1" >/dev/null 648 577 let "num = num + 1" >/dev/null 649 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null578 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 650 579 651 580 if test -r "Makefile"; then … … 658 587 testmake $? $num || let "numfail = numfail + 1" >/dev/null 659 588 let "num = num + 1" >/dev/null 660 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null589 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 661 590 662 591 # … … 685 614 testmake $? $num || let "numfail = numfail + 1" >/dev/null 686 615 let "num = num + 1" >/dev/null 687 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null616 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 688 617 689 618 if test -r "Makefile"; then … … 696 625 testmake $? $num || let "numfail = numfail + 1" >/dev/null 697 626 let "num = num + 1" >/dev/null 698 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null627 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 699 628 # 700 629 fi … … 709 638 fi 710 639 # 711 [ -z "${SMATCH}" ] || { CC="${SAVE_CC}"; export CC; SMATCH=""; export SMATCH; }712 #713 640 ${TOP_SRCDIR}/configure --quiet --enable-network=client --enable-static --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test --with-timeserver=127.0.0.1 ${C_LOGFILE} > /dev/null 2>> test_log 714 641 # … … 716 643 testmake $? $num || let "numfail = numfail + 1" >/dev/null 717 644 let "num = num + 1" >/dev/null 718 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null645 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 719 646 720 647 if test -r "Makefile"; then … … 727 654 testmake $? $num || let "numfail = numfail + 1" >/dev/null 728 655 let "num = num + 1" >/dev/null 729 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 730 # 731 [ -z "${SMATCH_CC}" ] || { CC="${SMATCH_CC}"; export CC; SMATCH="${SAVE_SMATCH}"; export SMATCH; } 656 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 732 657 # 733 658 # test c/s compilation w/ gpg … … 755 680 testmake $? $num || let "numfail = numfail + 1" >/dev/null 756 681 let "num = num + 1" >/dev/null 757 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null682 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 758 683 # 759 684 if test -r "Makefile"; then … … 766 691 testmake $? $num || let "numfail = numfail + 1" >/dev/null 767 692 let "num = num + 1" >/dev/null 768 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null693 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 769 694 fi 770 695 … … 784 709 testmake $? $num || let "numfail = numfail + 1" >/dev/null 785 710 let "num = num + 1" >/dev/null 786 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null711 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 787 712 # 788 713 if test -r "Makefile"; then … … 795 720 testmake $? $num || let "numfail = numfail + 1" >/dev/null 796 721 let "num = num + 1" >/dev/null 797 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null722 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 798 723 799 724 # … … 811 736 testmake $? $num || let "numfail = numfail + 1" >/dev/null 812 737 let "num = num + 1" >/dev/null 813 run_ smatch$? $num debug || let "numfail = numfail + 1" >/dev/null738 run_clang $? $num debug || let "numfail = numfail + 1" >/dev/null 814 739 # 815 740 if test -r "Makefile"; then … … 822 747 testmake $? $num || let "numfail = numfail + 1" >/dev/null 823 748 let "num = num + 1" >/dev/null 824 run_ smatch$? $num debug || let "numfail = numfail + 1" >/dev/null749 run_clang $? $num debug || let "numfail = numfail + 1" >/dev/null 825 750 826 751 # … … 838 763 testmake $? $num || let "numfail = numfail + 1" >/dev/null 839 764 let "num = num + 1" >/dev/null 840 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null765 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 841 766 # 842 767 if test -r "Makefile"; then … … 849 774 testmake $? $num || let "numfail = numfail + 1" >/dev/null 850 775 let "num = num + 1" >/dev/null 851 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null776 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 852 777 853 778 # … … 865 790 testmake $? $num || let "numfail = numfail + 1" >/dev/null 866 791 let "num = num + 1" >/dev/null 867 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null792 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 868 793 # 869 794 if test -r "Makefile"; then … … 876 801 testmake $? $num || let "numfail = numfail + 1" >/dev/null 877 802 let "num = num + 1" >/dev/null 878 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null803 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 879 804 880 805 # … … 892 817 testmake $? $num || let "numfail = numfail + 1" >/dev/null 893 818 let "num = num + 1" >/dev/null 894 run_ smatch$? $num debug || let "numfail = numfail + 1" >/dev/null819 run_clang $? $num debug || let "numfail = numfail + 1" >/dev/null 895 820 # 896 821 if test -r "Makefile"; then … … 903 828 testmake $? $num || let "numfail = numfail + 1" >/dev/null 904 829 let "num = num + 1" >/dev/null 905 run_ smatch$? $num debug || let "numfail = numfail + 1" >/dev/null830 run_clang $? $num debug || let "numfail = numfail + 1" >/dev/null 906 831 907 832 # … … 919 844 testmake $? $num || let "numfail = numfail + 1" >/dev/null 920 845 let "num = num + 1" >/dev/null 921 run_ smatch$? $num || let "numfail = numfail + 1" >/dev/null846 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 922 847 # 923 848 if test -r "Makefile"; then … … 930 855 testmake $? $num || let "numfail = numfail + 1" >/dev/null 931 856 let "num = num + 1" >/dev/null 932 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 933 934 [ -z "${SMATCH}" ] || { CC="${SAVE_CC}"; export CC; } 857 run_clang $? $num || let "numfail = numfail + 1" >/dev/null 935 858 936 859 log_end "COMPILE"
Note:
See TracChangeset
for help on using the changeset viewer.