2
0

check-subst-prog.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #! /bin/sh
  2. # Copyright (C) 2008-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 @substituted@ TESTS, some of which are also PROGRAMS.
  17. # See also sister test 'check-subst.sh'.
  18. # For gen-testsuite-part: ==> try-with-serial-tests <==
  19. required='cc native'
  20. . test-init.sh
  21. cat >> configure.ac << 'END'
  22. AC_PROG_CC
  23. AC_SUBST([script_tests],
  24. ['subst-pass-script.test subst-xfail-script.test'])
  25. AC_SUBST([prog_tests],
  26. ['subst-pass-prog.test$(EXEEXT) subst-xfail-prog.test$(EXEEXT)'])
  27. AC_SUBST([xfail_tests],
  28. ['xfail-script.test subst-xfail-script.test]dnl
  29. [ xfail-prog$(EXEEXT) subst-xfail-prog.test$(EXEEXT)'])
  30. AC_OUTPUT
  31. END
  32. cat > Makefile.am << 'END'
  33. TESTS = pass-script.test xfail-script.test @script_tests@ $(check_PROGRAMS)
  34. XFAIL_TESTS = @xfail_tests@
  35. check_PROGRAMS = pass-prog xfail-prog @prog_tests@
  36. EXTRA_PROGRAMS = subst-pass-prog.test subst-xfail-prog.test
  37. END
  38. cat > pass-script.test <<'END'
  39. #! /bin/sh
  40. exit 0
  41. END
  42. cat > xfail-script.test <<'END'
  43. #! /bin/sh
  44. exit 1
  45. END
  46. chmod a+x pass-script.test xfail-script.test
  47. cp pass-script.test subst-pass-script.test
  48. cp xfail-script.test subst-xfail-script.test
  49. cat > pass-prog.c <<'END'
  50. int main (void) { return 0; }
  51. END
  52. cat > xfail-prog.c <<'END'
  53. #include <stdlib.h>
  54. int main (void) { return EXIT_FAILURE; }
  55. END
  56. # The .test extension is removed for the default source file name:
  57. cp pass-prog.c subst-pass-prog.c
  58. cp xfail-prog.c subst-xfail-prog.c
  59. $ACLOCAL
  60. $AUTOCONF
  61. $AUTOMAKE -a
  62. ./configure
  63. $MAKE all
  64. $MAKE check
  65. $MAKE distclean
  66. mkdir build
  67. cd build
  68. ../configure
  69. $MAKE all
  70. $MAKE check
  71. $MAKE distclean
  72. :