Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/charisee/ertest/scripts/run.sh
ViewVC logotype

View of /branches/charisee/ertest/scripts/run.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2859 - (download) (as text) (annotate)
Thu Jan 22 07:37:46 2015 UTC (4 years, 8 months ago) by cchiw
File size: 2672 byte(s)
added regression tests
#!/bin/ksh
#
# A script for running the Diderot regression tests.
#
# usage:
#	scripts/run.sh [diderotc] [diderotc-flags] [-- runtime-flags]
#
# rtest/scripts/run.sh.  Generated from run_sh.in by configure.
#

# set up the path so that we can find unu
#
PATH=/bin:/usr/bin:/usr/local/teem-build/bin

function usage {
  echo "usage:"
  echo "  scripts/run.sh [diderotc] [diderotc-flags] [-- runtime-flags]"
  exit $1
}

# this script should be run from the rtest directory
#
HERE=$(pwd)
if [ ! -d $HERE/tests ] ; then
  echo "run script from rtest directory"
  exit 1
fi

# process command-line arguments
#
DIDEROTC="/Users/chariseechiw/Desktop/diderot/charisee/bin/diderotc"
DIDEROTC_FLAGS=""
RUNTIME_FLAGS=""
if [ $# -ne 0 ] ; then
  # first we check for the diderotc command
  case $1 in
    -*) ;; # no diderot command
    /*) DIDEROTC=$1; shift ;; # absolute path
    *) DIDEROTC=$HERE/$1; shift ;; #relative path
  esac
  # get diderotc flags
  while [ $# -ne 0 ] ; do
    case $1 in
      --) shift; break ;; # switch modes
      -*) DIDEROTC_FLAGS="$DIDEROTC_FLAGS $1" ;;
      *) echo "unrecognized argument"
        usage 1
      ;;
    esac
    shift
  done
  # get runtime flags
  while [ $# -ne 0 ] ; do
    case $1 in
      -*) RUNTIME_FLAGS="$RUNTIME_FLAGS $1" ;;
      *) echo "unrecognized argument"
        usage 1
      ;;
    esac
    shift
  done
fi

#
# check that the diderotc path is valid
#
if [ ! -x $DIDEROTC ] ; then
  echo "$DIDEROTC is not executable or does not exist"
  exit 1
fi

# get a list of all of the tests (one per directory)
#
TESTS=$(cd tests; ls)

DATE=$( date +"%F-%H-%M-%S" )
LOG=$HERE/log.$DATE
REPORT=$HERE/report.$DATE

echo "testing $DIDEROTC $DIDEROTC_FLAGS" > $REPORT
for t in $TESTS ; do
( cd tests/$t;
  echo "********** $t **********" >> $LOG
  echo -n "checking $t ... " >> $REPORT
  echo "$DIDEROTC $DIDEROTC_FLAGS $t.diderot" >> $LOG
  $DIDEROTC $DIDEROTC_FLAGS $t.diderot 2>> $LOG 1>> $LOG
  if [ "$?" -eq "0" ] ; then
    echo -n "compile succeeded ... " >> $REPORT
    echo "./$t $RUNTIME_FLAGS" >> $LOG
    ./$t $RUNTIME_FLAGS 2>> $LOG 1>> $LOG
    if [ "$?" -eq "0" ] ; then
      echo -n "execution succeeded ... " >> $REPORT
      result=$(./assess.sh)
      if (($result < 1.0)) ; then
	echo "result is good ($result)" >> $REPORT
	echo "ok" >> $LOG
	echo "$t is okay"
	rm -f $t.c $t.cl $t.o $t $t.log $t.txt
      else
	echo "result is bad ($result)" >> $REPORT
	echo "$t failed"
      fi
    else
      echo "execution failed" >> $REPORT
      echo "$t failed"
    fi
  else
    echo "compile failed" >> $REPORT
    echo "$t failed"
  fi
  echo "**********" >> $LOG
)
done
echo "complete report at $REPORT"

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0