testvcodex revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber: vcodex test harness
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber-\?) print -u2 "Usage: testvcodex [-v] [cc-options] [*.h] [*.c]"
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graberwhile : "$@" :
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber *.c) files="$files $1" ;;
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber */*.h) inc="$inc -I${1%/*}" ;;
f74e080cf75f958b3e52dff9e858fd722f66301eStéphane Graber *.h) inc="$inc -I." ;;
f74e080cf75f958b3e52dff9e858fd722f66301eStéphane Graber -l*) lib="$lib $1" ;;
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber -*|*,*) inc="$inc $1" ;;
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber *) base=${1##*/}
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber case $base in
f74e080cf75f958b3e52dff9e858fd722f66301eStéphane Graber *.*) lib="$lib $1" ;;
f74e080cf75f958b3e52dff9e858fd722f66301eStéphane Graberif test -d $unit
f74e080cf75f958b3e52dff9e858fd722f66301eStéphane Graberthen source=$unit
f74e080cf75f958b3e52dff9e858fd722f66301eStéphane Graber"") inc=-I$source ;;
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber"") lib=-last ;;
f74e080cf75f958b3e52dff9e858fd722f66301eStéphane Grabercase $files in
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber"") eval files='"' $source/*.c '"' ;;
c586a4dcc923ce6bbe0304642bd738d7b5faff21Tai Kedzierskicase $verbose in
c586a4dcc923ce6bbe0304642bd738d7b5faff21Tai Kedzierski'') trap 'rm -f t.exe t-*.exe xxx yyy zzz; exit 0' 0 1 2 13 15 ;;
c586a4dcc923ce6bbe0304642bd738d7b5faff21Tai Kedzierski*) inc="-DTVERBOSE $inc" ;;
4eb706b3ce9891f86ff3f9b5b5d063922df9f6b6Stéphane Graberinteger tests=0 errors=0 locked=0
207bf0e475f1dc6e9a2dac2cee3a209b56427855Stéphane Graberprint -u2 "TEST $unit"
207bf0e475f1dc6e9a2dac2cee3a209b56427855Stéphane Graberprev="make test"
207bf0e475f1dc6e9a2dac2cee3a209b56427855Stéphane Graberfor v in $(dlls --info 2>/dev/null)
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graberdo if [[ $v == env=* ]]
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber then v=${v#env=}
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber export $v=$INSTALLROOT/lib/vcodex:$INSTALLROOT/lib:$e
acabe1faee82d44db391345a8a51b9dec3dc0229Stéphane Graberfor file in $files
acabe1faee82d44db391345a8a51b9dec3dc0229Stéphane Graberdo (( tests = tests + 1 ))
acabe1faee82d44db391345a8a51b9dec3dc0229Stéphane Graber test=${file%.c}
acabe1faee82d44db391345a8a51b9dec3dc0229Stéphane Graber test=${test##*/}
acabe1faee82d44db391345a8a51b9dec3dc0229Stéphane Graber print -u2 -f "%-15s " $test
acabe1faee82d44db391345a8a51b9dec3dc0229Stéphane Graber (( locked = locked + 1 ))
acabe1faee82d44db391345a8a51b9dec3dc0229Stéphane Graber print -u2 previous $prev t.exe locked
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber # XXX compensate for nmake -lvcodex/foo => plugin #
fad967669817061cda3aafc40be04dcb712a4767Dwight Engen lcl= plugins=
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber case $file in
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber *crypt*)plugins="$plugins crypt" ;;
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber *rdb*) plugins="$plugins rdb" ;;
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber *sum*) plugins="$plugins sum" ;;
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber for p in $plugins
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber do set -A plugin $INSTALLROOT/lib/vcodex/*$p*
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber [[ -f ${plugin[1]} ]] && lcl="$lcl ${plugin[1]}"
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber "$@" $inc -o t.exe $file $lcl $lib >&9 2>&1
fad967669817061cda3aafc40be04dcb712a4767Dwight Engen rm -f ${test}.[oO]*
33aa351ac13936fb2549403f18a44fed32b2edfbStéphane Graber case $code in
33aa351ac13936fb2549403f18a44fed32b2edfbStéphane Graber then print -u2 passed
33aa351ac13936fb2549403f18a44fed32b2edfbStéphane Graber *) print -u2 compile FAILED
33aa351ac13936fb2549403f18a44fed32b2edfbStéphane Graber (( errors = errors + 1 ))
fad967669817061cda3aafc40be04dcb712a4767Dwight Engenmsg="TEST $unit, $tests test"
fad967669817061cda3aafc40be04dcb712a4767Dwight Engencase $tests in
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Graber*) msg=${msg}s ;;
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Grabermsg="$msg, $errors error"
71d3a6590fe665421d7a0026d699b0654ddfc7f6Stéphane Grabercase $errors in
b0f0932a944abf6425e9f185dea9c6d9ba6e8436Stéphane Graber*) msg=${msg}s ;;
b0f0932a944abf6425e9f185dea9c6d9ba6e8436Stéphane Graberprint -u2 "$msg"