testsuite-recheck.sh 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. # Check performance of recheck target in the face of many failed tests.
  17. # FIXME: this test is not currently able to detect whether the measured
  18. # FIXME: performance is too low, and FAIL accordingly; it just offers an
  19. # FIXME: easy way to verify how effective a performance optimization is.
  20. . test-init.sh
  21. count=5000
  22. cat >> configure.ac <<'END'
  23. AC_OUTPUT
  24. END
  25. cat > Makefile.am <<END
  26. count_expected = $count
  27. TEST_EXTENSIONS = .t
  28. ## Updated later.
  29. TESTS =
  30. END
  31. # This should ensure that our timing won't be disturbed by the time
  32. # that would be actually required to run any of:
  33. # - the test cases
  34. # - the test driver executing them
  35. # - the recipe to create the final test-suite log.
  36. cat >> Makefile.am << 'END'
  37. AUTOMAKE_OPTIONS = -Wno-override
  38. ## These should never be run.
  39. T_LOG_COMPILER = false
  40. T_LOG_DRIVER = false
  41. # The recipe of this also serves as a sanity check.
  42. $(TEST_SUITE_LOG):
  43. ## For debugging.
  44. @echo "RE-RUN:"; for i in $(TEST_LOGS); do echo " $$i"; done
  45. ## All the test cases should have been re-run.
  46. @count_got=`for i in $(TEST_LOGS); do echo $$i; done | wc -l` \
  47. && echo "Count expected: $(count_expected)" \
  48. && echo "Count obtained: $$count_got" \
  49. && test $$count_got -eq $(count_expected)
  50. ## Pre-existing log files of the tests to re-run should have been
  51. ## removed by the 'recheck' target
  52. @for i in $(TEST_LOGS); do \
  53. test ! -f $$i.log || { echo "$$i.log exists!"; exit 1; }; \
  54. done
  55. ## Actually create the target file, for extra safety.
  56. @echo dummy > $@
  57. END
  58. # Updated later.
  59. : > all
  60. # Temporarily disable shell traces, to avoid bloating the log file.
  61. set +x
  62. for i in $(seq_ 1 $count); do
  63. echo dummy $i > $i.log
  64. echo :global-test-result: PASS > $i.trs
  65. echo :test-result: PASS >> $i.trs
  66. echo :recheck: yes >> $i.trs
  67. echo TESTS += $i.t >> Makefile.am
  68. echo $i >> all
  69. done
  70. # Re-enable shell traces.
  71. set -x
  72. # So that we don't need to create a ton of dummy tests.
  73. echo '$(TESTS):' >> Makefile.am
  74. head -n 100 Makefile.am || : # For debugging.
  75. tail -n 100 Makefile.am || : # Likewise.
  76. cat $count.trs # Likewise, just the last specimen though.
  77. $ACLOCAL
  78. $AUTOCONF
  79. $AUTOMAKE -a
  80. ./configure
  81. $MAKE recheck
  82. :