gnits2.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #! /bin/sh
  2. # Copyright (C) 2002-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 to ensure std-options checking is correct.
  17. required='cc native'
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_PROG_CC
  21. AC_OUTPUT
  22. END
  23. cat > Makefile.am << 'END'
  24. AUTOMAKE_OPTIONS = gnits
  25. noinst_PROGRAMS = fubar2
  26. bin_PROGRAMS = fubar sub/fine
  27. nobase_bin_PROGRAMS = sub/fubar3
  28. fubar_SOURCES = fubar.c
  29. fubar2_SOURCES = fubar.c
  30. sub_fubar3_SOURCES = fubar.c
  31. sub_fine_SOURCES = fine.c
  32. bin_SCRIPTS = sub/scriptok.sh sub/scriptnok.sh
  33. grep-stderr:
  34. grep 'pfubar$(EXEEXT) does not support' stderr
  35. grep 'pfubar3$(EXEEXT) does not support' stderr
  36. grep 'pscriptnok\.sh does not support' stderr
  37. ## Only three failures please.
  38. test `grep 'does not support --help' stderr | wc -l` = 3
  39. test `grep 'does not support --version' stderr | wc -l` = 3
  40. test-install: install
  41. test -f ../inst-dir/bin/pfine$(EXEEXT)
  42. test ! -f ../inst-dir/bin/fine$(EXEEXT)
  43. END
  44. cat > fubar.c <<'END'
  45. int main (void)
  46. {
  47. return 0;
  48. }
  49. END
  50. cat > fine.c << 'END'
  51. #include <stdio.h>
  52. int main (void)
  53. {
  54. puts ("Which version? Which usage?");
  55. return 0;
  56. }
  57. END
  58. mkdir sub
  59. cat >sub/scriptok.sh <<EOF
  60. #!/bin/sh
  61. echo "Which version? Which usage?"
  62. EOF
  63. # Not only does this script not support --help/--version, but
  64. # it will also hang when run without input.
  65. cat >sub/scriptnok.sh <<EOF
  66. #!/bin/sh
  67. cat
  68. EOF
  69. chmod +x sub/scriptok.sh
  70. chmod +x sub/scriptnok.sh
  71. # Files required by Gnits.
  72. : > INSTALL
  73. : > NEWS
  74. : > README
  75. : > COPYING
  76. : > AUTHORS
  77. : > ChangeLog
  78. : > THANKS
  79. # The following file should not be distributed.
  80. # (alpha.sh checks the case where it must be distributed.)
  81. : > README-alpha
  82. $ACLOCAL
  83. $AUTOCONF
  84. $AUTOMAKE -a
  85. grep README-alpha Makefile.in && exit 1
  86. mkdir build
  87. cd build
  88. # Use --program-prefix to make sure the std-options check honors it.
  89. ../configure "--prefix=$(pwd)/../inst-dir" --program-prefix=p
  90. $MAKE all
  91. $MAKE test-install
  92. # Don't trust th exit status of "make -k" for non-GNU makes.
  93. if using_gmake; then status=FAIL; else status=IGNORE; fi
  94. run_make -e $status -E -- -k installcheck
  95. $MAKE grep-stderr
  96. :