built-sources-check.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. # Make sure 'check:' honors $(BUILT_SOURCES).
  17. # PR/359.
  18. # For gen-testsuite-part: ==> try-with-serial-tests <==
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_CONFIG_FILES([dir/Makefile])
  22. AC_OUTPUT
  23. END
  24. mkdir dir
  25. cat > Makefile.am << 'END'
  26. BUILT_SOURCES = command1.inc
  27. SUBDIRS = dir
  28. TESTS = subrun.sh
  29. subrun.sh:
  30. (echo '#! /bin/sh'; cat command1.inc) > $@
  31. chmod +x $@
  32. command1.inc:
  33. echo 'dir/echo.sh' > $@
  34. CLEANFILES = subrun.sh command1.inc
  35. END
  36. cat > dir/Makefile.am << 'END'
  37. BUILT_SOURCES = command2.inc
  38. check_SCRIPTS = echo.sh
  39. echo.sh:
  40. ## The next line ensures that command1.inc has been built before
  41. ## recurring into the subdir.
  42. test -f ../command1.inc
  43. (echo '#! /bin/sh'; cat command2.inc) > $@
  44. chmod +x $@
  45. command2.inc:
  46. echo 'echo Hello' > $@
  47. CLEANFILES = echo.sh command2.inc
  48. END
  49. $ACLOCAL
  50. $AUTOCONF
  51. $AUTOMAKE -a
  52. ./configure --prefix "$(pwd)/inst"
  53. run_make -O check
  54. grep '^PASS: subrun\.sh *$' stdout
  55. grep 'PASS.*echo\.sh' stdout && exit 1
  56. $MAKE distcheck
  57. :