parallel-am.sh 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. # Test parallel automake execution.
  17. # There are several hypotheses to be tested: Independently of the number
  18. # of threads used by automake,
  19. # 0) the generated Makefile.in files must be identical without --add-missing,
  20. # 1) the Makefile.in that distributes auxiliary files must be generated
  21. # after all other ones, so all installed aux files are caught,
  22. # 2) normal automake output should have identical content and be ordered
  23. # in the same way, when --add-missing is not passed, or when
  24. # --add-missing is passed but there are no concurrent file requirements
  25. # (i.e., two Makefile.am files call for the same needed aux file)
  26. # 3) normal automake output should be identical and ordered in the same way
  27. # with --add-missing, even with concurrent file requirements, and the
  28. # installation of aux files should be race-free,
  29. # 4) warning and normal error output should be identical, in that duplicate
  30. # warnings should be omitted in the same way as without threads,
  31. # 5) fatal error and debug messages could be identical. This is not
  32. # intended, though.
  33. #
  34. # This test checks (0), (1), and (2). See sister tests for further coverage.
  35. required=perl-threads
  36. . test-init.sh
  37. cat > configure.ac << 'END'
  38. AC_INIT([parallel-am], [1.0])
  39. AC_CONFIG_AUX_DIR([build-aux])
  40. AM_INIT_AUTOMAKE
  41. AC_PROG_CC
  42. AM_PATH_LISPDIR
  43. AM_PATH_PYTHON
  44. AC_CONFIG_FILES([Makefile])
  45. END
  46. cat > Makefile.am << 'END'
  47. SUBDIRS =
  48. END
  49. list='1 2 3 4 5 6 7 8 9'
  50. for i in $list; do
  51. echo "AC_CONFIG_FILES([sub$i/Makefile])" >> configure.ac
  52. echo "SUBDIRS += sub$i" >> Makefile.am
  53. mkdir sub$i
  54. echo > sub$i/Makefile.am
  55. done
  56. # Use an include chain to cause a nontrivial location object to be
  57. # serialized through a thread queue.
  58. echo 'include foo.am' >> sub7/Makefile.am
  59. echo 'include bar.am' > sub7/foo.am
  60. echo 'python_PYTHON = foo.py' > sub7/bar.am
  61. echo 'lisp_LISP = foo.el' >> sub8/Makefile.am
  62. echo 'bin_PROGRAMS = p' >> sub9/Makefile.am
  63. rm -f install-sh missing depcomp
  64. mkdir build-aux
  65. $ACLOCAL
  66. # This test may have to be run several times in order to expose the
  67. # race that, when the last Makefile.in (the toplevel one) is created
  68. # before the other ones have finished, not all auxiliary files may
  69. # be installed yet, thus some may not be distributed.
  70. #
  71. # Further, automake output should be stable.
  72. # Generate expected output using the non-threaded code.
  73. unset AUTOMAKE_JOBS
  74. AUTOMAKE_run --add-missing
  75. mv stderr expected
  76. Makefile_ins=$(find . -name Makefile.in)
  77. for file in $Makefile_ins; do
  78. mv $file $file.exp
  79. done
  80. AUTOMAKE_JOBS=5
  81. export AUTOMAKE_JOBS
  82. for run in 1 2 3 4 5 6 7; do
  83. rm -f build-aux/* sub*/Makefile.in
  84. AUTOMAKE_run --add-missing
  85. diff stderr expected
  86. for file in $Makefile_ins; do
  87. diff $file $file.exp
  88. done
  89. done
  90. :