parallel-tests-empty-testlogs.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 parallel-tests features:
  17. # - empty TESTS
  18. # - empty TEST_LOGS
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
  22. AC_OUTPUT
  23. END
  24. cat > Makefile.am << 'END'
  25. SUBDIRS = sub1 sub2
  26. END
  27. mkdir sub1 sub2
  28. cat > sub1/Makefile.am << 'END'
  29. TESTS =
  30. END
  31. # When $(TESTS) is empty, NetBSD 5.1 make ends up defining $(TESTS_LOGS)
  32. # to ".log" rather than to the empty string (as would be expected).
  33. # But our recipes are smart enough to work around such a botched-up
  34. # substitution, so let's not bother too much about it.
  35. if using_gmake; then
  36. unindent >> sub1/Makefile.am << 'END'
  37. check-local:
  38. echo $(TEST_LOGS) | grep . && exit 1; exit 0
  39. END
  40. fi
  41. cat > sub2/Makefile.am << 'END'
  42. TESTS = foo.test
  43. END
  44. cat > sub2/foo.test <<'END'
  45. #! /bin/sh
  46. exit 0
  47. END
  48. chmod a+x sub2/foo.test
  49. $ACLOCAL
  50. $AUTOCONF
  51. $AUTOMAKE -a
  52. no_test_has_run ()
  53. {
  54. ls -1 *.log | grep -v '^test-suite\.log$' | grep . && exit 1
  55. grep '^# TOTAL: *0$' test-suite.log
  56. :
  57. }
  58. for vpath in : false; do
  59. if $vpath; then
  60. mkdir build
  61. cd build
  62. srcdir=..
  63. else
  64. srcdir=.
  65. fi
  66. $srcdir/configure
  67. cd sub1
  68. VERBOSE=yes $MAKE check
  69. no_test_has_run
  70. cd ../sub2
  71. run_make VERBOSE=yes TESTS= check
  72. no_test_has_run
  73. run_make VERBOSE=yes TEST_LOGS= check
  74. no_test_has_run
  75. cd ..
  76. $MAKE check
  77. cat sub2/foo.log
  78. $MAKE distclean
  79. cd $srcdir
  80. done
  81. :