#!/bin/csh -f
##### 
##   Sung-Hoon Ko
##   4/11/98
#####


# Run synthetic test cases

set sources = (allgatherO.java  alltoallO.java    bcastO.java \
               gatherO.java     scatterO.java \
               gathervO.java    allgathervO.java  scattervO.java \
               alltoallvO.java  reduceO.java      allreduceO.java \
               scanO.java       reduce_scatterO.java) 
 
set nprocs  = 3

set mpiJavaHome = ../..
set mpiJavaClasses = ../../lib/classes

set JAVA_PATH = /usr/java1.2

set CLASS_PATH = "-classpath .:${mpiJavaClasses}:${JAVA_PATH}/lib/classes.zip:${JAVA_PATH}/classes"
set JAVA_C = "${JAVA_PATH}/bin/javac ${CLASS_PATH}"
set JAVA_RUN = "${JAVA_PATH}/bin/java ${CLASS_PATH}"

cat > diffs <<.
.

set CWD = `pwd`
foreach source ($sources)
  echo ...Compiling : {$CWD:t}/${source}
  ${JAVA_C} $source

  set executable=${source:r}
  if ( -f ./$executable.jig ) then
    rm -f ./$executable.jig
  endif
  echo .....Running : prunjava $nprocs $executable
  $mpiJavaHome/src/scripts/prunjava $nprocs $executable | tee ${executable}.out
  if ( -f ${executable}.out.sample ) then
    echo .....diff ${executable}.out ${executable}.out.sample
    cat >> diffs <<.
diff ${executable}.out ${executable}.out.sample
.
    diff ${executable}.out ${executable}.out.sample | tee -a diffs
  else
    echo .....${executable}.out.sample absent.  Recreated.
    cp ${executable}.out ${executable}.out.sample
  endif
  rm -f ${executable}.class
end

