######################################################################### # Invocation arguments are: # # -lLIBRARY: a library to be linked with, e.g., -lpthread # # -v: verbose, print the compilation command # # -c: continue testing after a test fails # # -whatever_else: bad argument, will be ignored. # # tests: test cases to be run. If no test specified, # # all tests will be run. # # # # Written by Kiem-Phong Vo # ######################################################################### verbose=0 exit_on_fail=1 files="" LIBS="../libvthread.a" HDRS="" DEFS="-Dvt_threaded=1" XLIBS="" while test "$1" != "" do case $1 in -l*) XLIBS="$XLIBS $1"; ;; -v) verbose=1; ;; -c) exit_on_fail=0; ;; -*) echo "Hmm, unknown argument: $1"; ;; *) files="${files} $1"; ;; esac shift done if test "$CC" = ""; then CC="cc"; fi if test "$files" = "" then files="*.c" fi LIBS="$LIBS $XLIBS" if test "$verbose" = 1 then echo "Compiler invocation: $CC -g $DEFS -I. -I.. $HDRS xxx.c $LIBS -o ./t" fi for i in $files do echo "-- $i:" status="" if $CC -g $DEFS -I. -I.. $HDRS $i $LIBS -o ./t then if ./t then rm ./t; status=Passed else status=Failed fi else status="Not compiled" fi echo " $status" if test "$status" != "Passed" then if test "$exit_on_fail" = "1"; then exit; fi fi done