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


# Run synthetic test cases
set sources = (bsend.java   bsend_free.java  buffer.java getcount.java  \
	       interf.java  iprobe.java isend.java probe.java rsend.java\
               rsend2.java  sendrecv.java    sendrecv_rep.java seq.java \
               ssend.java     start.java  \
               startall.java  test1.java    test2.java     test3.java  \
               testall.java   testany.java  testsome.java  waitall.java \
               waitany.java   waitsome.java waitnull.java  wildcard.java) 

set nprocs  = 2

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


