Changes in trunk/test/testcompile.sh [19:30]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/testcompile.sh
r19 r30 1 1 #! /bin/sh 2 2 3 MAXTEST=28; export MAXTEST 3 # 4 # Copyright Rainer Wichmann (2006) 5 # 6 # License Information: 7 # This program is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # This program is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with this program; if not, write to the Free Software 19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 # 21 22 MAXTEST=57; export MAXTEST 23 24 run_flawfinder () 25 { 26 flawfinder --minlevel=3 --quiet src/s*.c | \ 27 egrep '^No hits found.' >/dev/null 2>&1 28 if [ $? -eq 0 ]; then 29 [ -z "$quiet" ] && log_ok $2 ${MAXTEST} "$TEST"; 30 else 31 flawfinder --minlevel=3 --quiet src/s*.c >test_log 2>&1 32 [ -z "$quiet" ] && log_fail $2 ${MAXTEST} "$TEST"; 33 return 1 34 fi 35 } 36 37 run_smatch () 38 { 39 export CDIR=`pwd`; 40 41 if [ -z "$doall" ]; then 42 [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (smatch)"; 43 return 0 44 fi 45 46 if [ "x$3" = "xdebug" ]; then memcheck=debug; else memcheck=simple; fi 47 if [ -f ../sm_scripts/smatch.pm ]; then 48 ( 49 cd ../sm_scripts; 50 51 for i in ${CDIR}/*.c.sm ; do 52 # echo $i; 53 cat $i | ./unreached_code.pl; 54 cat $i | ./ampersand_missing.sh; 55 cat $i | ./uninitialized.pl; 56 cat $i | ./eqeq.pl; 57 cat $i | ./for_bounds.pl; 58 cat $i | ./unchecked_returns.pl; 59 cat $i | ./unreached_code.pl; 60 cat $i | ./uninitialized.pl; 61 # from http://people.redhat.com/mstefani/wine/smatch/ 62 if [ -f ./while_for_check.pl ]; then 63 cat $i | ./while_for_check.pl; 64 fi 65 # --> end wine <-- 66 # samhain specific 67 if [ $memcheck = xsimple ]; then 68 if [ -f ./samhain_unfree.pl ]; then 69 cat $i | ./samhain_unfree.pl | \ 70 egrep -v 'x_cutest_.*Test_' | \ 71 egrep -v 'x_sh_unix.c .... .... sh_unix_copyenv'; 72 fi 73 fi 74 if [ $memcheck = xdebug ]; then 75 if [ -f ./samhain_unfree_debug.pl ]; then 76 cat $i | ./samhain_unfree_debug.pl | \ 77 egrep -v 'x_cutest_.*Test_' | \ 78 egrep -v 'x_sh_unix.c .... .... sh_unix_copyenv'; 79 fi 80 fi 81 # --> end samhain specific <-- 82 #cat $i | ./unfree.pl | \ 83 # egrep -v 'x_cutest_.*Test_' | \ 84 # grep -v 'x_sh_unix.c .... .... sh_unix_copyenv'; 85 touch list_null_funcs_uniq; 86 cat $i | ./deference_check.pl; 87 rm -f list_null_funcs_uniq; 88 rm -f $i 89 done 90 ) >test_log_smatch 2>&1 91 if [ -f test_log_smatch ]; then 92 lines=`cat test_log_smatch | wc -l` 93 if [ $lines -ne 0 ]; then 94 cat test_log_smatch 95 rm -f test_log_smatch 96 [ -z "$quiet" ] && log_fail $2 ${MAXTEST} "$TEST (smatch)"; 97 return 1 98 fi 99 fi 100 [ -z "$quiet" ] && log_ok $2 ${MAXTEST} "$TEST (smatch)"; 101 return 0 102 fi 103 [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (smatch)"; 104 return 0 105 } 4 106 5 107 testmake () … … 8 110 if test x$1 = x0; then 9 111 [ -z "$verbose" ] || log_msg_ok "configure... $TEST"; 10 $MAKE cutest > /dev/null 2>> test_log112 $MAKE ${SMATCH} cutest > /dev/null 2>> test_log 11 113 if test x$? = x0; then 12 114 [ -z "$verbose" ] || log_msg_ok "make cutest... $TEST"; … … 34 136 log_start "COMPILE" 35 137 138 if [ -f /usr/local/gcc-smatch/bin/gcc ]; then 139 SAVE_CC="${CC}" 140 SMATCH="DBGDEF=--smatch"; export SMATCH 141 CC="/usr/local/gcc-smatch/bin/gcc"; export CC 142 fi 143 36 144 num=0 37 145 numfail=0 38 146 39 147 # 148 # test flawfinder 149 # 150 TEST="${S}check w/flawfinder${E}" 151 # 152 # 153 let "num = num + 1" >/dev/null 154 FLAWFINDER=`find_path flawfinder` 155 # 156 if [ -z "$FLAWFINDER" ]; then 157 log_skip $num $MAXTEST 'check w/flawfinder (not in PATH)' 158 else 159 run_flawfinder 0 $num || let "numfail = numfail + 1" >/dev/null 160 fi 161 # 162 163 # 40 164 # test standalone compilation 41 165 # 42 TEST="${S}standalone agentw/suidcheck${E}"166 TEST="${S}standalone w/suidcheck${E}" 43 167 # 44 168 if test -r "Makefile"; then … … 50 174 let "num = num + 1" >/dev/null 51 175 testmake $? $num || let "numfail = numfail + 1" >/dev/null 176 let "num = num + 1" >/dev/null 177 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 52 178 53 179 # 54 180 # test standalone compilation 55 181 # 56 TEST="${S}standalone agent w/mounts-check andw/userfiles${E}"182 TEST="${S}standalone w/mounts-check w/userfiles${E}" 57 183 # 58 184 if test -r "Makefile"; then … … 64 190 let "num = num + 1" >/dev/null 65 191 testmake $? $num || let "numfail = numfail + 1" >/dev/null 192 let "num = num + 1" >/dev/null 193 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 66 194 67 195 … … 69 197 # test standalone compilation 70 198 # 71 TEST="${S}standalone agent w/timeserver and w/message-queue${E}"199 TEST="${S}standalone w/timeserver and w/msgqueue${E}" 72 200 # 73 201 if test -r "Makefile"; then … … 79 207 let "num = num + 1" >/dev/null 80 208 testmake $? $num || let "numfail = numfail + 1" >/dev/null 209 let "num = num + 1" >/dev/null 210 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 81 211 82 212 # 83 213 # test standalone compilation with --with-nocl=PW 84 214 # 85 TEST="${S}standalone agentw/nocl${E}"215 TEST="${S}standalone w/nocl${E}" 86 216 # 87 217 if test -r "Makefile"; then … … 93 223 let "num = num + 1" >/dev/null 94 224 testmake $? $num || let "numfail = numfail + 1" >/dev/null 225 let "num = num + 1" >/dev/null 226 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 95 227 96 228 # 97 229 # test standalone compilation w/ debug 98 230 # 99 TEST="${S}standalone agentw/debug${E}"231 TEST="${S}standalone w/debug${E}" 100 232 # 101 233 if test -r "Makefile"; then … … 107 239 let "num = num + 1" >/dev/null 108 240 testmake $? $num || let "numfail = numfail + 1" >/dev/null 241 let "num = num + 1" >/dev/null 242 run_smatch $? $num debug || let "numfail = numfail + 1" >/dev/null 109 243 110 244 # 111 245 # test standalone compilation w/ gpg 112 246 # 113 TEST="${S}standalone agentw/gpg${E}"247 TEST="${S}standalone w/gpg${E}" 114 248 # 115 249 GPG=`find_path gpg` … … 118 252 if [ -z "$GPG" ]; then 119 253 log_skip $num $MAXTEST 'gpg not in PATH' 254 let "num = num + 1" >/dev/null 120 255 else 121 256 if test -r "Makefile"; then … … 126 261 # 127 262 testmake $? $num || let "numfail = numfail + 1" >/dev/null 263 let "num = num + 1" >/dev/null 264 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 128 265 fi 129 266 … … 131 268 # test standalone compilation w/stealth 132 269 # 133 TEST="${S}standalone agentw/stealth${E}"270 TEST="${S}standalone w/stealth${E}" 134 271 # 135 272 if test -r "Makefile"; then … … 141 278 let "num = num + 1" >/dev/null 142 279 testmake $? $num || let "numfail = numfail + 1" >/dev/null 280 let "num = num + 1" >/dev/null 281 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 143 282 144 283 # 145 284 # test standalone compilation w/logwatch 146 285 # 147 TEST="${S}standalone agentw/login-watch${E}"286 TEST="${S}standalone w/login-watch${E}" 148 287 # 149 288 if test -r "Makefile"; then … … 155 294 let "num = num + 1" >/dev/null 156 295 testmake $? $num || let "numfail = numfail + 1" >/dev/null 296 let "num = num + 1" >/dev/null 297 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 157 298 158 299 # 159 300 # test standalone compilation w/mysql 160 301 # 161 TEST="${S}standalone agentw/mysql${E}"302 TEST="${S}standalone w/mysql${E}" 162 303 # 163 304 if test -r "Makefile"; then … … 169 310 let "num = num + 1" >/dev/null 170 311 testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null 312 let "num = num + 1" >/dev/null 313 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 171 314 172 315 # 173 316 # test standalone compilation w/postgresql 174 317 # 175 TEST="${S}standalone agentw/postgresql${E}"318 TEST="${S}standalone w/postgresql${E}" 176 319 # 177 320 if test -r "Makefile"; then … … 183 326 let "num = num + 1" >/dev/null 184 327 testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null 328 let "num = num + 1" >/dev/null 329 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 185 330 186 331 # 187 332 # test standalone compilation 188 333 # 189 TEST="${S}standalone agentw/o mail${E}"334 TEST="${S}standalone w/o mail${E}" 190 335 # 191 336 if test -r "Makefile"; then … … 197 342 let "num = num + 1" >/dev/null 198 343 testmake $? $num || let "numfail = numfail + 1" >/dev/null 344 let "num = num + 1" >/dev/null 345 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 199 346 200 347 # 201 348 # test standalone compilation 202 349 # 203 TEST="${S}standalone agent w/o external scripts${E}"350 TEST="${S}standalone w/o external${E}" 204 351 # 205 352 if test -r "Makefile"; then … … 211 358 let "num = num + 1" >/dev/null 212 359 testmake $? $num || let "numfail = numfail + 1" >/dev/null 360 let "num = num + 1" >/dev/null 361 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 213 362 214 363 # echo; echo "${S}__ TEST CLIENT/SERVER __${E}"; echo; … … 227 376 let "num = num + 1" >/dev/null 228 377 testmake $? $num || let "numfail = numfail + 1" >/dev/null 378 let "num = num + 1" >/dev/null 379 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 229 380 230 381 if test -r "Makefile"; then … … 236 387 let "num = num + 1" >/dev/null 237 388 testmake $? $num || let "numfail = numfail + 1" >/dev/null 389 let "num = num + 1" >/dev/null 390 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 238 391 239 392 # … … 247 400 if [ -z "$GPG" ]; then 248 401 log_skip $num $MAXTEST 'gpg not in PATH' 249 let "num = num + 1" >/dev/null 250 log_skip $num $MAXTEST 'gpg not in PATH' 402 let "num = num + 3" >/dev/null 251 403 else 252 404 if test -r "Makefile"; then … … 257 409 # 258 410 testmake $? $num || let "numfail = numfail + 1" >/dev/null 411 let "num = num + 1" >/dev/null 412 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 259 413 # 260 414 if test -r "Makefile"; then … … 266 420 let "num = num + 1" >/dev/null 267 421 testmake $? $num || let "numfail = numfail + 1" >/dev/null 422 let "num = num + 1" >/dev/null 423 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 268 424 fi 269 425 … … 282 438 let "num = num + 1" >/dev/null 283 439 testmake $? $num || let "numfail = numfail + 1" >/dev/null 440 let "num = num + 1" >/dev/null 441 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 284 442 # 285 443 if test -r "Makefile"; then … … 291 449 let "num = num + 1" >/dev/null 292 450 testmake $? $num || let "numfail = numfail + 1" >/dev/null 451 let "num = num + 1" >/dev/null 452 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 293 453 294 454 # … … 305 465 let "num = num + 1" >/dev/null 306 466 testmake $? $num || let "numfail = numfail + 1" >/dev/null 467 let "num = num + 1" >/dev/null 468 run_smatch $? $num debug || let "numfail = numfail + 1" >/dev/null 307 469 # 308 470 if test -r "Makefile"; then … … 314 476 let "num = num + 1" >/dev/null 315 477 testmake $? $num || let "numfail = numfail + 1" >/dev/null 478 let "num = num + 1" >/dev/null 479 run_smatch $? $num debug || let "numfail = numfail + 1" >/dev/null 316 480 317 481 # … … 328 492 let "num = num + 1" >/dev/null 329 493 testmake $? $num || let "numfail = numfail + 1" >/dev/null 494 let "num = num + 1" >/dev/null 495 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 330 496 # 331 497 if test -r "Makefile"; then … … 337 503 let "num = num + 1" >/dev/null 338 504 testmake $? $num || let "numfail = numfail + 1" >/dev/null 505 let "num = num + 1" >/dev/null 506 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 339 507 340 508 # … … 351 519 let "num = num + 1" >/dev/null 352 520 testmake $? $num || let "numfail = numfail + 1" >/dev/null 521 let "num = num + 1" >/dev/null 522 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 353 523 # 354 524 if test -r "Makefile"; then … … 360 530 let "num = num + 1" >/dev/null 361 531 testmake $? $num || let "numfail = numfail + 1" >/dev/null 532 let "num = num + 1" >/dev/null 533 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 362 534 363 535 # … … 374 546 let "num = num + 1" >/dev/null 375 547 testmake $? $num || let "numfail = numfail + 1" >/dev/null 548 let "num = num + 1" >/dev/null 549 run_smatch $? $num debug || let "numfail = numfail + 1" >/dev/null 376 550 # 377 551 if test -r "Makefile"; then … … 383 557 let "num = num + 1" >/dev/null 384 558 testmake $? $num || let "numfail = numfail + 1" >/dev/null 559 let "num = num + 1" >/dev/null 560 run_smatch $? $num debug || let "numfail = numfail + 1" >/dev/null 385 561 386 562 # 387 563 # test client/server compilation 388 564 # 389 TEST="${S}client/server application w/o external scripts${E}"565 TEST="${S}client/server application w/o external${E}" 390 566 # 391 567 if test -r "Makefile"; then … … 397 573 let "num = num + 1" >/dev/null 398 574 testmake $? $num || let "numfail = numfail + 1" >/dev/null 575 let "num = num + 1" >/dev/null 576 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 399 577 # 400 578 if test -r "Makefile"; then … … 406 584 let "num = num + 1" >/dev/null 407 585 testmake $? $num || let "numfail = numfail + 1" >/dev/null 586 let "num = num + 1" >/dev/null 587 run_smatch $? $num || let "numfail = numfail + 1" >/dev/null 588 589 [ -z "${SMATCH}" ] || { CC="${SAVE_CC}"; export CC; } 408 590 409 591 log_end "COMPILE"
Note:
See TracChangeset
for help on using the changeset viewer.