parallel-tests-log-compiler-example.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #! /bin/sh
  2. # Copyright (C) 2011-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. # Test the example of usage of generic and extension-specific
  17. # LOG_COMPILER and LOG_FLAGS given in the manual.
  18. required=python
  19. . test-init.sh
  20. cat >> configure.ac <<END
  21. AC_SUBST([PERL], ['$PERL'])
  22. AM_PATH_PYTHON
  23. AC_OUTPUT
  24. END
  25. cat > Makefile.am << 'END'
  26. TESTS = foo.pl bar.py baz
  27. TEST_EXTENSIONS = .pl .py
  28. PL_LOG_COMPILER = $(PERL)
  29. AM_PL_LOG_FLAGS = -w
  30. PY_LOG_COMPILER = $(PYTHON)
  31. AM_PY_LOG_FLAGS = -v
  32. LOG_COMPILER = ./wrapper-script
  33. AM_LOG_FLAGS = -d
  34. END
  35. echo 'my $a =+ 2; exit (0);' > foo.pl
  36. echo 'import sys; sys.exit(0);' > bar.py
  37. : > baz
  38. cat > wrapper-script <<'END'
  39. #!/bin/sh
  40. echo "wrapper args: $*"
  41. END
  42. chmod a+x wrapper-script
  43. $ACLOCAL
  44. $AUTOCONF
  45. $AUTOMAKE -a
  46. ./configure
  47. st=0
  48. $MAKE check || st=$?
  49. cat foo.log
  50. cat bar.log
  51. cat baz.log
  52. test $st -eq 0 || exit $st
  53. # Check that the wrappers have been run with the expected flags.
  54. grep '[rR]eversed.*+=.*operator.*foo\.pl' foo.log
  55. grep '^# *[cC]lear.*sys\.argv' bar.log
  56. grep '^wrapper args:.* -d .*baz' baz.log
  57. :