home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / TESTS / CHECK < prev    next >
Text File  |  1996-06-04  |  2KB  |  101 lines

  1. #!/bin/csh -f
  2. #
  3. # Test program for Wild-LIFE
  4. #
  5. #    test *.lf
  6. #   or
  7. #    test program
  8. #
  9. # This program run Wild-LIFE over one or several test programs and records the
  10. # differences in the standard and error outputs.
  11. #
  12. #
  13. # Read-only files:
  14. #    program.lf    Life source code
  15. #    program.in    Life user input
  16. #    program.ref    Reference standard output
  17. #    program.referr    Reference error output
  18. #
  19. # Output files:
  20. #    program.out    Most recent standard output
  21. #    program.err    Most recent error output
  22. #    program.refdiff Difference between .out and .ref files
  23. #    program.errdiff Difference between .err and .referr files
  24. #
  25.  
  26.  
  27. # Make all files rw by everyone
  28. umask 000
  29.  
  30.  
  31. # Version of Wild-LIFE to use:
  32. set WLIFE = "../Source/wild_life"
  33.  
  34.  
  35. # clear
  36. echo "Testing interpreter: $WLIFE"
  37. echo "Date: `date`"
  38. echo ""
  39. # echo ""
  40. # echo "                       Wild-LIFE test suite"
  41. # echo "                       --------------------"
  42. # echo ""
  43. # echo "interpreter: $WLIFE"
  44. # echo ""
  45. # echo ""
  46. # echo ""
  47.  
  48.  
  49.  
  50.  
  51. # Run the test suite
  52. foreach I ($*)
  53.  
  54.    echo $I
  55.  
  56. if(-e LF/$I:r.lf) then
  57.  
  58. # Remove any core dumps
  59.    rm -f core
  60.  
  61. # Run Wild-LIFE
  62.    (echo 'load("LF/' $I:r.lf '")?' | tr -d ' ' ;echo "" ; \
  63.     cat IN/$I:r.in  ; echo "halt?") | \
  64.     ($WLIFE |  \
  65. egrep -v '(Loading|already loaded|Version|customizing|Copyright|Garbage|Exiting|X interface)' > OUT/$I:r.out \
  66.         ) |& \
  67.         sed "s/.......s cpu (.*)//" > ERR/$I:r.err
  68.  
  69. # Check for core dump
  70.    if(-e core) then
  71.     echo "          ***    C O R E   D U M P  ! !       ***"
  72.    endif
  73.  
  74. # Calculate the differences
  75.    (diff OUT/$I:r.out REFOUT/$I:r.refout > REFDIFF/$I:r.refdiff) >& /dev/null
  76.    (diff ERR/$I:r.err REFERR/$I:r.referr > ERRDIFF/$I:r.errdiff) >& /dev/null
  77.  
  78.  
  79. # Report them to the developer
  80.    if(`wc -c < REFDIFF/$I:r.refdiff` != 0) then
  81.         echo "          *** output does not match reference ***"
  82.    else
  83.         rm -f REFDIFF/$I:r.refdiff
  84.    endif
  85.  
  86.    if(`wc -c < ERRDIFF/$I:r.errdiff` != 0) then
  87.     echo "          ***  errors do not match reference  ***"
  88.    else
  89.         rm -f ERRDIFF/$I:r.errdiff
  90.    endif
  91.  
  92. else
  93.    echo "          ***  no such test file  ***"
  94. endif
  95.  
  96. end
  97.  
  98. echo ""
  99. echo "Test finished: `date`"
  100. echo ""
  101.