make-keepgoing.tap 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #! /bin/sh
  2. # Copyright (C) 2013-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 $(am__make_keepgoing) works as expected.
  17. . test-init.sh
  18. plan_ 60
  19. mkdir kool # Also used later.
  20. if echo nil: | $MAKE -I kool -f -; then
  21. make_supports_option_I () { return 0; }
  22. else
  23. make_supports_option_I () { return 1; }
  24. fi
  25. echo AC_OUTPUT >> configure.ac
  26. cat > Makefile.am <<'END'
  27. all:
  28. @echo 'Default target $@ should not be called'>&2; exit 1;
  29. k-y:
  30. @echo ":: $$MAKEFLAGS :: $$MFLAGS ::" ;: For debugging.
  31. $(am__make_keepgoing)
  32. k-n:
  33. @echo ":: $$MAKEFLAGS :: $$MFLAGS ::" ;: For debugging.
  34. $(am__make_keepgoing) && exit 1; exit 0
  35. END
  36. check_make ()
  37. {
  38. msg= mode= condition=: directive= reason= skip_reason=
  39. case $1 in
  40. k-[yn]) mode=$1;;
  41. *) fatal_ "check_run: invalid usage";;
  42. esac
  43. shift
  44. while test $# -gt 0; do
  45. case $1 in
  46. -C) condition=$2 skip_reason=$3; shift; shift;;
  47. -M) msg=$2; shift;;
  48. -X) directive=TODO;;
  49. --) shift; break;;
  50. *) break;;
  51. esac
  52. shift
  53. done
  54. for opts in '' '-s' '-s -r'; do
  55. r=ok
  56. pmsg=${mode}${msg:+" [$msg]"}${opts:+" ($opts)"}
  57. if $condition; then
  58. $MAKE $opts "$mode" ${1+"$@"} || r='not ok'
  59. else
  60. directive=SKIP reason=$skip_reason
  61. fi
  62. result_ "$r" -D "$directive" -r "$reason" "$pmsg"
  63. done
  64. unset r msg pmsg opts mode condition directive reason skip_reason
  65. }
  66. # ----------------------------------------------------------------------
  67. $ACLOCAL || fatal_ "aclocal failed"
  68. $AUTOCONF || fatal_ "autoconf failed"
  69. $AUTOMAKE || fatal_ "automake failed"
  70. ./configure || fatal_ "configure failed"
  71. # ----------------------------------------------------------------------
  72. check_make k-n
  73. # Test against a possible regressions similar to those that affected
  74. # detection of dry mode ("make -n").
  75. check_make k-n TESTS="k.test k2.test"
  76. check_make k-n TESTS="k1 k2" AM_MAKEFLAGS="TESTS='k1 k2'"
  77. check_make k-n TESTS="k1 k k2" AM_MAKEFLAGS='TESTS="k1 k k2"'
  78. check_make k-n FOOFLAGS="-k -k -nkf2 k -ks --keep -k"
  79. check_make k-n MYFLAGS="-k --keepgoing -k --keep-run -k"
  80. # ----------------------------------------------------------------------
  81. check_make k-y -k
  82. check_make k-y -C using_gmake "\$MAKE is not GNU make" --keep-going
  83. # ----------------------------------------------------------------------
  84. # Related to automake bug#12554: the "k" in "kool" used to confound
  85. # am__make_keepgoing into thinking the '-k' option had been passed.
  86. pr='bug#12554'
  87. check_make k-n -C make_supports_option_I "-I make option unsupported" \
  88. -M "$pr" -I kool
  89. check_make k-n -C using_gmake "\$MAKE is not GNU make" \
  90. -M "$pr" -I kool --include keep-going
  91. check_make k-y -C make_supports_option_I "-I make option unsupported" \
  92. -M "$pr" -I kool -k
  93. check_make k-y -C using_gmake "\$MAKE is not GNU make" \
  94. -M "$pr" --keep-going -I kool --include keep-going
  95. # ----------------------------------------------------------------------
  96. # Test for when shell metacharacters or backslashes are in $(MAKEFLAGS).
  97. check_metachars ()
  98. {
  99. check_make k-n -M "metachars" "$@"
  100. }
  101. check_metachars MYFLAGS="-k \"k\" '-k' --keep-going -k"
  102. check_metachars MYFLAGS='-knf2\ k\ \\k'
  103. check_metachars MYFLAGS="(&) | ; \" \` '"
  104. check_metachars MYFLAGS=" ' # ' "
  105. check_metachars MYFLAGS='$(foo)'
  106. check_metachars MYFLAGS='$(foo -k)'
  107. check_metachars MYFLAGS='`touch bad`'
  108. check_metachars MYFLAGS='`touch --keep-going bad`'
  109. # ----------------------------------------------------------------------
  110. :