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


# Run synthetic test cases

set sources = (allgather.java      allreduce.java  allreduce_maxminloc.java \
               alltoall.java       barrier.java \
               bcast.java          gather.java     reduce.java \
               reduce_scatter.java scan.java       scatter.java \
               gatherv.java        allgatherv.java scatterv.java \
               alltoallv.java) 
 
set nprocs  = 3


set mpiJavaHome = @top_srcdir@
set mpiJavaClasses = @top_srcdir@/lib/classes

set JAVA_PATH = @JAVA@

set CLASS_PATH = "-classpath .:${mpiJavaClasses}:${JAVA_PATH}/lib/classes.zip:${JAVA_PATH}/classes:/project/pss_shko/mpiJava/V0.9/tests/simple"
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


