test-driver-is-distributed.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #! /bin/sh
  2. # Copyright (C) 2011-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 regression of parallel-tests:
  17. # - 'test-driver' script not correctly distributed when TESTS is
  18. # defined in a subdir Makefile
  19. am_create_testdir=empty
  20. . test-init.sh
  21. ocwd=$(pwd) || fatal_ "getting current working directory"
  22. for i in 1 2; do
  23. mkdir D$i
  24. cd D$i
  25. if test $i -eq 1; then
  26. auxdir=.
  27. test_driver=test-driver
  28. else
  29. auxdir=build-aux
  30. test_driver=$auxdir/test-driver
  31. mkdir $auxdir
  32. fi
  33. mkdir tests
  34. unindent > configure.ac << END
  35. AC_INIT([$me], [1.0])
  36. AC_CONFIG_AUX_DIR([$auxdir])
  37. AM_INIT_AUTOMAKE
  38. AC_CONFIG_FILES([Makefile tests/Makefile])
  39. AC_OUTPUT
  40. END
  41. unindent > Makefile.am << END
  42. SUBDIRS = tests
  43. check-local: test-top
  44. test-top: distdir
  45. ls -l \$(distdir) \$(distdir)/* ;: For debugging.
  46. test -f \$(distdir)/$test_driver
  47. .PHONY: test-top
  48. END
  49. unindent > tests/Makefile.am << END
  50. check-local: test-sub
  51. test-sub:
  52. echo ' ' \$(DIST_COMMON) ' ' | grep '[ /]$test_driver '
  53. TESTS = foo.test
  54. EXTRA_DIST = \$(TESTS)
  55. END
  56. unindent > tests/foo.test << 'END'
  57. #!/bin/sh
  58. exit 0
  59. END
  60. chmod a+x tests/foo.test
  61. $ACLOCAL
  62. $AUTOCONF
  63. $AUTOMAKE -a
  64. ./configure
  65. $MAKE test-top
  66. cd tests
  67. $MAKE test-sub
  68. cd ..
  69. $MAKE distcheck
  70. # Try code path without automatic installation of required files.
  71. mv -f Makefile.in Makefile.sav
  72. mv -f tests/Makefile.in tests/Makefile.sav
  73. $AUTOMAKE
  74. diff Makefile.in Makefile.sav
  75. diff tests/Makefile.in tests/Makefile.sav
  76. cd "$ocwd" || fatal_ "cannot chdir back to '$ocwd'"
  77. done
  78. :