remake-deeply-nested.sh 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #! /bin/sh
  2. # Copyright (C) 2010-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 remake rules in deeply nested subdirectories, and with a lot
  17. # of files. This is basically a mild stress test, ensuring that rebuild
  18. # rules don't break in obvious ways in a slightly "heavier than usual"
  19. # setup.
  20. . test-init.sh
  21. ocwd=$(pwd) || fatal_ "getting current working directory"
  22. magic1=::MagicStringOne::
  23. magic2=__MagicStringTwo__
  24. echo "AC_SUBST([FOO], [$magic1])" >> configure.ac
  25. echo "@FOO@" > bar.in
  26. echo "AC_CONFIG_FILES([bar])" >> configure.ac
  27. unset d # Avoid unduly interferences from the environment.
  28. for i in 0 1 2 3 4 5 6 7 8 9; do
  29. d=${d+"$d/"}sub$i
  30. echo "SUBDIRS = sub$i" > Makefile.am
  31. echo "AC_CONFIG_FILES([$d/Makefile])" >> "$ocwd"/configure.ac
  32. echo "AC_CONFIG_FILES([$d/bar])" >> "$ocwd"/configure.ac
  33. mkdir sub$i
  34. cd sub$i
  35. echo "$d: @FOO@" > bar.in
  36. done
  37. echo AC_OUTPUT >> "$ocwd"/configure.ac
  38. : > Makefile.am
  39. unset d i
  40. bottom=$(pwd) || fatal_ "getting current working directory"
  41. cd "$ocwd"
  42. makefiles_am_list=$(find . -name Makefile.am | LC_ALL=C sort)
  43. makefiles_list=$(echo "$makefiles_am_list" | sed 's/\.am$//')
  44. bar_in_list=$(find . -name bar.in | LC_ALL=C sort)
  45. bar_list=$(echo "$bar_in_list" | sed 's/\.in$//')
  46. cat configure.ac # For debugging.
  47. $ACLOCAL
  48. $AUTOMAKE
  49. $AUTOCONF
  50. ./configure
  51. for f in configure config.status $makefiles_list $bar_list; do
  52. $FGREP "$magic1" $f
  53. done
  54. $sleep
  55. sed "s/$magic1/$magic2/" configure.ac >configure.tmp
  56. mv -f configure.tmp configure.ac
  57. cd "$bottom"
  58. $MAKE
  59. cd "$ocwd"
  60. for f in configure config.status $makefiles_list $bar_list; do
  61. $FGREP "$magic2" $f
  62. done
  63. $FGREP "$magic1" configure config.status $makefiles_list $bar_list && exit 1
  64. $MAKE distcheck
  65. :