CheckListOfTests.am 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ## -*- Automake -*-
  2. ##
  3. ## Copyright (C) 2011-2017 Free Software Foundation, Inc.
  4. ##
  5. ## This program is free software; you can redistribute it and/or modify
  6. ## it under the terms of the GNU General Public License as published by
  7. ## the Free Software Foundation; either version 2, or (at your option)
  8. ## any later version.
  9. ##
  10. ## This program is distributed in the hope that it will be useful,
  11. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ## GNU General Public License for more details.
  14. ##
  15. ## You should have received a copy of the GNU General Public License
  16. ## along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ##
  18. ## Temporary files used in the 'check-list-of-tests' recipe.
  19. am__tmk = tests-in-makefile-list.tmp
  20. am__tfs = tests-on-filesystem-list.tmp
  21. am__tdf = diff-in-tests-lists.tmp
  22. ## Check that the list of tests given in the Makefile is equal to the
  23. ## list of all test scripts in the Automake testsuite.
  24. .PHONY: maintainer-check-list-of-tests
  25. maintainer-check-list-of-tests:
  26. ## Prefer unified diffs over plain diffs, for readability.
  27. @if diff -u /dev/null /dev/null >/dev/null 2>&1; then \
  28. diff='diff -u'; \
  29. else \
  30. diff='diff'; \
  31. fi; \
  32. ## List of tests in Makefile.
  33. lst='$(expected_list_of_tests)'; \
  34. test -n "$$lst" || lst='$(TESTS)'; \
  35. for t in $$lst; do \
  36. echo "$$t"; \
  37. done | sort >$(am__tmk); \
  38. ## List of subdirs where to look for tests.
  39. dirs='$(test_subdirs)'; \
  40. test -n "$$dirs" || dirs=.; \
  41. ## List of tests on filesystem. Be careful to cater for VPATH builds too.
  42. test_extensions='$(TEST_EXTENSIONS)'; \
  43. for ext in $$test_extensions; do \
  44. for dir in $$dirs; do \
  45. ls $$dir/*$$ext 2>/dev/null; \
  46. if test $(srcdir) != $(builddir); then \
  47. ($(am__cd) $(srcdir) && ls $$dir/*$$ext 2>/dev/null); \
  48. fi; \
  49. done; \
  50. done | sed 's,^\./,,' | sort | uniq >$(am__tfs); \
  51. ## Compare the two lists, complain if they differ.
  52. if $$diff $(am__tmk) $(am__tfs) >$(am__tdf); then \
  53. result=0; \
  54. else \
  55. echo '$@: list of tests in Makefile an on filesystem differ' >&2; \
  56. echo "+ $$diff in-makefile on-filesystem" >&2; \
  57. cat $(am__tdf) >&2; \
  58. result=1; \
  59. fi; \
  60. rm -f $(am__tmk) $(am__tfs) $(am__tdf); \
  61. exit $$result;
  62. .PHONY: clean-maintcheck-testslist-tmp
  63. clean-local: clean-maintcheck-testslist-tmp
  64. clean-maintcheck-testslist-tmp:
  65. rm -f $(am__tmk) $(am__tfs) $(am__tdf)