serial-tests.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #! /bin/sh
  2. # Copyright (C) 2012-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. # Option 'serial-tests'.
  17. am_create_testdir=empty
  18. . test-init.sh
  19. hasnt_parallel_tests ()
  20. {
  21. $EGREP 'TEST_SUITE_LOG|TEST_LOGS|\.log.*:' $1 && exit 1
  22. grep 'recheck.*:' $1 && exit 1
  23. grep '^check-TESTS: \$(TESTS)$' $1
  24. }
  25. has_parallel_tests ()
  26. {
  27. $EGREP '(^| )check-TESTS.*:' $1
  28. $EGREP '(^| )recheck.*:' $1
  29. grep '^\$(TEST_SUITE_LOG): \$(TEST_LOGS)$' $1
  30. grep '^\.test\.log:$' $1
  31. }
  32. mkdir one two
  33. cat > one/configure.ac <<END
  34. AC_INIT([$me], [1.0])
  35. AM_INIT_AUTOMAKE([serial-tests])
  36. AC_CONFIG_FILES([Makefile])
  37. END
  38. echo 'TESTS = foo.test bar.test' > one/Makefile.am
  39. cat > two/configure.ac <<END
  40. AC_INIT([$me], [2.0])
  41. AC_CONFIG_AUX_DIR([config])
  42. AM_INIT_AUTOMAKE([parallel-tests])
  43. AC_CONFIG_FILES([aMakefile bMakefile])
  44. END
  45. cp one/Makefile.am two/aMakefile.am
  46. cat - one/Makefile.am > two/bMakefile.am <<END
  47. AUTOMAKE_OPTIONS = serial-tests
  48. END
  49. cd one
  50. touch missing install-sh
  51. $ACLOCAL
  52. $AUTOMAKE
  53. grep TEST Makefile.in # For debugging.
  54. hasnt_parallel_tests Makefile.in
  55. test ! -e test-driver
  56. cd ..
  57. cd two
  58. mkdir config
  59. $ACLOCAL
  60. $AUTOMAKE --add-missing
  61. grep TEST [ab]Makefile.in # For debugging.
  62. has_parallel_tests aMakefile.in
  63. hasnt_parallel_tests bMakefile.in
  64. mv aMakefile.in aMakefile.sav
  65. mv bMakefile.in bMakefile.sav
  66. test ! -e test-driver
  67. test -f config/test-driver
  68. $AUTOMAKE
  69. diff aMakefile.sav aMakefile.in
  70. diff bMakefile.sav bMakefile.in
  71. cd ..
  72. :