test-extensions-cond.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. # Expose bug in conditional definition of TEST_EXTENSIONS.
  17. . test-init.sh
  18. cat >> configure.ac << 'END'
  19. AM_CONDITIONAL([COND], [:])
  20. AM_CONDITIONAL([COND2], [:])
  21. END
  22. $ACLOCAL
  23. cat > 1.am << 'END'
  24. TESTS =
  25. if COND
  26. ## lineno 4
  27. TEST_EXTENSIONS = .foo
  28. endif
  29. END
  30. cat > 2.am << 'END'
  31. TESTS =
  32. ## lineno 3
  33. TEST_EXTENSIONS = .foo
  34. if COND
  35. # Do nothing.
  36. else
  37. TEST_EXTENSIONS += .bar
  38. endif
  39. END
  40. cat > 3.am << 'END'
  41. TESTS =
  42. if COND
  43. if !COND2
  44. TESTS = x
  45. else
  46. ## lineno 7
  47. TEST_EXTENSIONS = .foo
  48. endif
  49. endif
  50. END
  51. : > test-driver
  52. for i in 1 2 3; do
  53. AUTOMAKE_fails $i
  54. lineno=$(sed -n 's/^## lineno //p' $i.am) \
  55. && test 0 -lt "$lineno" \
  56. || exit 99
  57. grep "^$i\\.am:$lineno:.*TEST_EXTENSIONS.*conditional content" stderr
  58. done
  59. :