processtests.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. # Generates the tests in tests/test/cg/variants by
  3. # a) generating the test programs
  4. # b) compiling them with kylix and running them
  5. # c) changing them based on the Kylix compilation and running result, so
  6. # they become self-checking
  7. # Only tested under Linux with Kylix installed, might also work under cygwin
  8. ./genvartests
  9. for file in tvarol*.pp
  10. do
  11. dcc $file
  12. if [ $? -ne 0 ]; then
  13. echo '{ %fail }' > $file.new
  14. cat $file >> $file.new
  15. mv $file.new $file
  16. else
  17. ./`basename $file .pp` > output
  18. if grep XXX output >/dev/null; then
  19. sed -e "s/writeln('YYY')/halt(1)/" < $file > $file.new
  20. mv $file.new $file
  21. fi
  22. if grep YYY output >/dev/null; then
  23. sed -e "s/writeln('XXX')/halt(1)/" < $file > $file.new
  24. mv $file.new $file
  25. fi
  26. if grep VVV output >/dev/null; then
  27. sed -e "s/writeln('COMPFAILV')/raise tobject.create/" < $file > $file.new
  28. else
  29. sed -e "s/writeln('VVV')/halt(1)/" < $file > $file.new
  30. fi
  31. mv $file.new $file
  32. if grep QQQ output >/dev/null; then
  33. sed -e "s/writeln('COMPFAILQ')/raise tobject.create/" < $file > $file.new
  34. else
  35. sed -e "s/writeln('QQQ')/halt(1)/" < $file > $file.new
  36. fi
  37. mv $file.new $file
  38. fi
  39. done