| 1 |
#!/bin/tcsh -f |
| 2 |
|
| 3 |
# This scripts runs the regression suite for the BuDDy package. |
| 4 |
# |
| 5 |
# Methodology |
| 6 |
# ----------- |
| 7 |
# This script is responsible to run the tests, compare against the expected |
| 8 |
# results, and print report. Each test is run from its own directory. |
| 9 |
# Each test directory is self contained, and should contain: |
| 10 |
# |
| 11 |
# + 'runtest' script which will create a file with the results - 'result' |
| 12 |
# This result file will be used by runregression to be compared against |
| 13 |
# the expected result. |
| 14 |
# |
| 15 |
# + 'expected' - the expected result. |
| 16 |
# It is the responsibility of each runtest script to produce the result |
| 17 |
# file clean from any unnecessary text which might cause to false alarms. |
| 18 |
# Examples : garbage collection messages, time / date messages, etc... |
| 19 |
# Be careful not to filter out important data !! |
| 20 |
# |
| 21 |
# + Executable to run. This executable will be run by runtest script of |
| 22 |
# each test. |
| 23 |
|
| 24 |
set RESULT_FILE = result |
| 25 |
set EXPECTED_FILE = expected |
| 26 |
set RUNTEST = runtest |
| 27 |
|
| 28 |
@ tests_to_run = 0 |
| 29 |
@ tests_passed = 0 |
| 30 |
|
| 31 |
if ( $#argv == 0 ) then |
| 32 |
set testdirs = ( `ls` ) |
| 33 |
else |
| 34 |
set testdirs = ( $argv[1-] ) |
| 35 |
endif |
| 36 |
|
| 37 |
foreach testdir ( $testdirs ) |
| 38 |
if ( -d $testdir && -e $testdir/$RUNTEST ) then # a test dir |
| 39 |
cd $testdir |
| 40 |
@ tests_to_run ++ |
| 41 |
|
| 42 |
# Clean to make sure no matter what - no old results exist |
| 43 |
if ( -e $RESULT_FILE ) rm $RESULT_FILE |
| 44 |
|
| 45 |
# Run the test! |
| 46 |
echo |
| 47 |
echo "Running test $testdir ( $tests_to_run ) ..." |
| 48 |
./$RUNTEST |
| 49 |
|
| 50 |
# Let's see if we have got result |
| 51 |
if ( -e $RESULT_FILE ) then |
| 52 |
|
| 53 |
# we have result, now compare to expected |
| 54 |
diff $RESULT_FILE $EXPECTED_FILE >& /dev/null |
| 55 |
if ( $status ) then # there is a diff between files |
| 56 |
echo "$testdir FAILED : diff found" |
| 57 |
else # no diff |
| 58 |
echo "$testdir PASSED" |
| 59 |
@ tests_passed++ |
| 60 |
endif |
| 61 |
|
| 62 |
else # no results - test failed |
| 63 |
echo "$testdir FAILED : no $RESULT_FILE created" |
| 64 |
endif |
| 65 |
if ( -e $RESULT_FILE ) rm $RESULT_FILE # clean what we have done |
| 66 |
cd .. |
| 67 |
endif |
| 68 |
end |
| 69 |
|
| 70 |
echo |
| 71 |
echo "Total tests to run : $tests_to_run" |
| 72 |
echo "Passed tests : $tests_passed" |