test-extensions.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. # Make sure that Automake diagnose invalid entries in TEST_EXTENSIONS,
  17. # and do not diagnose valid (albeit more unusual) ones.
  18. # See automake bug#9400.
  19. . test-init.sh
  20. cat >> configure.ac <<'END'
  21. AC_OUTPUT
  22. END
  23. $ACLOCAL
  24. $AUTOCONF
  25. valid_extensions='sh T t1 _foo BAR x_Y_z _'
  26. echo TESTS = > Makefile.am
  27. echo " $valid_extensions" \
  28. | sed -e 's/ / ./g' -e 's/^/TEST_EXTENSIONS =/' >> Makefile.am
  29. cat Makefile.am # For debugging.
  30. $AUTOMAKE -a
  31. grep -i 'log' Makefile.in # For debugging.
  32. for lc in $valid_extensions; do
  33. uc=$(echo $lc | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ)
  34. $FGREP "\$(${uc}_LOG_COMPILER)" Makefile.in
  35. grep "^${uc}_LOG_COMPILE =" Makefile.in
  36. grep "^\.${lc}\.log:" Makefile.in
  37. done
  38. # The produced Makefile is not broken.
  39. ./configure
  40. $MAKE all check
  41. cat > Makefile.am << 'END'
  42. TESTS = foo.test bar.sh
  43. TEST_EXTENSIONS = .test mu .x-y a-b .t.1 .sh .6c .0 .11 .= @suf@ .@ext@
  44. TEST_EXTENSIONS += .= .t33 .a@b _&_
  45. END
  46. AUTOMAKE_fails
  47. for suf in mu .x-y a-b .t.1 .6c .0 .11 @suf@ .@ext@ '.=' '_&_'; do
  48. suf2=$(printf '%s\n' "$suf" | sed -e 's/\./\\./')
  49. $EGREP "^Makefile\.am:2:.*invalid test extension.* $suf2( |$)" stderr
  50. done
  51. # Verify that we accept valid suffixes, even if intermixed with
  52. # invalid ones.
  53. $EGREP '\.(sh|test|t33)' stderr && exit 1
  54. # Verify that we don't try to handle invalid suffixes.
  55. $EGREP '(LOG_COMPILER|non-POSIX var|bad character)' stderr && exit 1
  56. :