dejagnu3.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #! /bin/sh
  2. # Copyright (C) 2003-2017 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Check that the DejaGnu rules work for a simple program and test case.
  17. required=runtest
  18. . test-init.sh
  19. cat > hammer << 'END'
  20. #! /bin/sh
  21. echo "Everything looks like a nail to me!"
  22. END
  23. chmod +x hammer
  24. cat >> configure.ac << 'END'
  25. AC_OUTPUT
  26. END
  27. cat > Makefile.am << 'END'
  28. AUTOMAKE_OPTIONS = dejagnu
  29. DEJATOOL = hammer
  30. AM_RUNTESTFLAGS = HAMMER=$(srcdir)/hammer
  31. EXTRA_DIST = hammer hammer.test/hammer.exp
  32. END
  33. mkdir hammer.test
  34. cat > hammer.test/hammer.exp << 'END'
  35. set test test
  36. spawn $HAMMER
  37. expect {
  38. "Everything looks like a nail to me!" { pass "$test" }
  39. default { fail "$test" }
  40. }
  41. END
  42. $ACLOCAL
  43. $AUTOCONF
  44. $AUTOMAKE --add-missing
  45. ./configure
  46. $MAKE check
  47. test -f hammer.log
  48. test -f hammer.sum
  49. $MAKE distcheck
  50. # Ensure that the envvar RUNTESTFLAGS is used.
  51. # Report from Mark Mitchell.
  52. RUNTESTFLAGS=--unknown-runtest-option; export RUNTESTFLAGS
  53. run_make -M -e FAIL check
  54. $FGREP 'unknown-runtest-option' output
  55. :