#!/bin/sh
#
# Usage: all
#
# Calls 'guide' or 'speech' command on all script files in sibling 'test'
# directory, which have corresponding log files.  Assumes any
# file with no extension in test directory is a script file.
#
result=0
this=`dirname $0`
for f in `find $this/../test -maxdepth 1 -not -name '*.*' -type f -print`
  do
    if [ -f $f.guide ]; then
      read line < $f.guide
      speech=`expr "$line" : ".*Speech"`
      if [ $speech == 0 ]; then
         $this/guide $f
      else 
         $this/speech $f
      fi
      result=`expr $result + $?`
    fi
  done
if [ $result == 0 ]; then
  echo "All successful"
else
  echo "Failed $result test(s)!"
fi
exit $result
