#!/bin/sh echo " Regression version 1.01" # The directory that contains the regression tests... DEFAULT_TEST_DIR="." CURRENT_DIR=`pwd` cd ${1:-$DEFAULT_TEST_DIR} TEST_DIR=`pwd` # for use with that IFS stuff TMP="" # if any of these phrases appear in the output of a make test we will # consider that regression test failed BAD_WORDS="Parse error|Syntax error|Compilation Failed|Invalid|NullPointerException|Memory fault|FAILURE" # if this word doesn't appear in the output of a make test we will # consider that regression test failed NEEDED_WORDS="SUCCESS" demjava -version echo "Getting tests from: $TEST_DIR ..." 1>&2 demjava -version > $CURRENT_DIR/results.$$ 2>&1 result="Success" echo "Failures ->" > $CURRENT_DIR/results.failure for suite in $TEST_DIR/suite-*; do if [ -d $suite ]; then echo "" echo "***Test Suite, $suite..." 1>&2 echo "" >> $CURRENT_DIR/results.$$ echo "***Test Suite, $suite:" >> $CURRENT_DIR/results.$$ suite_result="Success" for test in $suite/j-*; do if [ -d $test ]; then echo " Testing $test..." 1>&2 echo " Testing $test:" >> $CURRENT_DIR/results.$$ cd $test make clean > /dev/null make test > $test/output 2>&1 make clean > /dev/null test_result="Success" TMP=$IFS IFS="|" for bad in $BAD_WORDS ; do if fgrep -s $bad $test/output ; then echo " Error: had a $bad" >> $CURRENT_DIR/results.$$ echo "$test" >> $CURRENT_DIR/results.failure echo " Failure -- why? had a $bad" >> $CURRENT_DIR/results.failure result="Failure" suite_result="Failure" test_result="Failure" fi done if(test $test_result != "Failure"); then for good in $NEEDED_WORDS ; do if fgrep -s $good $test/output ; then # bah, there must be a better way... echo "do nothing" >> /dev/null else echo " Error: did not have a $good" >> $CURRENT_DIR/results.$$ echo "$test" >> $CURRENT_DIR/results.failure echo " Failure -- why? didn't show $good" >> $CURRENT_DIR/results.failure result="Failure" suite_result="Failure" test_result="Failure" fi done fi IFS=$TMP fi echo " $test_result" 1>&2 echo " $test_result" >> $CURRENT_DIR/results.$$ done echo "Suite $suite seems to have been a $suite_result" 1>&2 echo "Suite $suite seems to have been a $suite_result" >> $CURRENT_DIR/results.$$ echo "" else for test in $TEST_DIR/j-*; do if [ -d $test ]; then echo " Testing $test..." 1>&2 echo " Testing $test:" >> $CURRENT_DIR/results.$$ cd $test make clean > /dev/null make test > $test/output 2>&1 test_result="Success" TMP=$IFS IFS="|" for bad in $BAD_WORDS ; do if fgrep -s $bad $test/output ; then echo " Error: had a $bad" >> $CURRENT_DIR/results.$$ echo "$test" >> $CURRENT_DIR/results.failure echo " Failure -- why? had a $bad" >> $CURRENT_DIR/results.failure result="Failure" test_result="Failure" fi done if(test $test_result != "Failure"); then for good in $NEEDED_WORDS ; do if fgrep -s $good $test/output ; then # bah, there must be a better way... echo "do nothing" >> /dev/null else echo " Error: did not have a $good" >> $CURRENT_DIR/results.$$ echo "$test" >> $CURRENT_DIR/results.failure echo " Failure -- why? didn't show $good" >> $CURRENT_DIR/results.failure result="Failure" test_result="Failure" test_result="Failure" fi done fi IFS=$TMP fi echo " $test_result" 1>&2 echo " $test_result" >> $CURRENT_DIR/results.$$ done fi done echo "" echo "Done." cat $CURRENT_DIR/results.failure rm -f $CURRENT_DIR/results.$$ echo "" echo "Looks like this regression test was a $result." 2>&1