home *** CD-ROM | disk | FTP | other *** search
/ ftp.ee.pdx.edu / 2014.02.ftp.ee.pdx.edu.tar / ftp.ee.pdx.edu / pub / users / Harry / compilers / p11 / run2 < prev    next >
Text File  |  2006-03-01  |  1KB  |  35 lines

  1. #!/bin/sh
  2. #
  3. # Use this shell script to test your program.  It will compile and run
  4. # a test program.
  5. #
  6. # For example, to test a file named simple.pcat, type:
  7. #       run2 simple
  8. #
  9. # The following files are assumed to exist:
  10. #       tst/simple.pcat
  11. #       tst/simple.givenInput
  12. #       tst/simple.givenOutput1
  13. #       tst/simple.givenOutput2
  14. #
  15. # The "givenInput" file will be used as the input to simple; "givenOutput1"
  16. # is what should be produced on stdout and "givenOutput2" is what should
  17. # be produced on stderr.
  18. #
  19. # This script uses "pc" to compile and execute your PCAT program.  It feeds
  20. # "givenInput" to the program and compares its output with the "givenOutput"
  21. # files, displaying any differences.
  22. #
  23. # This script will create the following files:
  24. #       tst/simple.s
  25. #       tst/simple
  26. #       tst/simple.newOutput1
  27. #       tst/simple.newOutput2
  28. #
  29. echo $1:
  30. pc tst/$1 < tst/$1.givenInput 1> tst/$1.newOutput1 2> tst/$1.newOutput2
  31. diff -w tst/$1.givenOutput1 tst/$1.newOutput1
  32. diff -w tst/$1.givenOutput2 tst/$1.newOutput2
  33. rm -f tst/$1.newOutput1
  34. rm -f tst/$1.newOutput2
  35.