# semco-test - script to test Semco with nohup
# Eirik Hektoen, 1997

# Script runs the GDE/Lisp image named as the first command line
# argument (default gde only applies when no arguments), compiles and
# loads "semco" and any other files named as further arguments, and
# then calls semco-test.

DIR=`pwd`
PRG=/anfs/tiptmp/eh101/nanlt.pa
JOB=$HOME/tmp/eh101-job-$$
COM=$HOME/tmp/eh101-com-$$
INP=$HOME/tmp/eh101-inp-$$
OUT=$DIR/semco-test.out

LOAD="\"semco\""
until [ ${2-""} = "" ]
do LOAD="$LOAD \"$2\""; shift
done

cat > $COM <<- xxx
  (chdir "$DIR")
  (dolist (x '($LOAD)) (compile-file-if-needed x))
  (exit)
xxx

cat > $INP <<- xxx
  (chdir "$DIR")
  (dolist (x '($LOAD)) (load x))
  (semco-test-corpus)
  (exit)
xxx

cat > $JOB <<- xxx
  TZ=GMT
  cd $DIR
  echo Testing Semco with $PRG on \`hostname\`
  date
  echo
  echo Compiling load files...
  echo
  echo "!(load \"$COM\")" | nice $PRG
  echo
  echo Starting the testing...
  echo
  echo "!(load \"$INP\")" | nice $PRG
  echo
  echo Testing finished.
  date
  rm $COM $INP $JOB
xxx

echo Will run $PRG, load $LOAD,
echo and call semco-test-corpus...
echo

OLD=$OUT-old
if [ -f $OLD ]; then rm $OLD; fi
if [ -f $OUT ]; then mv $OUT $OLD; fi

nohup sh $JOB > $OUT &
echo Started nohup process $!
echo with output to $OUT
