test-trs-recover2.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 harness features:
  17. # - recovery from unreadable '.trs' files, in various scenarios
  18. . test-init.sh
  19. cat >> configure.ac <<END
  20. AC_OUTPUT
  21. END
  22. cat > Makefile.am << 'END'
  23. TESTS = foo.test bar.test
  24. TEST_LOG_COMPILER = true
  25. END
  26. : > foo.test
  27. : > bar.test
  28. TEST_STATUS=0; export TEST_STATUS
  29. $ACLOCAL
  30. $AUTOCONF
  31. $AUTOMAKE -a
  32. ./configure
  33. : > t
  34. chmod a-r t && test ! -r t || skip_ "you can still read unreadable files"
  35. rm -f t
  36. : Create the required log files.
  37. $MAKE check
  38. test -f foo.trs
  39. test -f bar.trs
  40. : Recreate with a sweeping "make check".
  41. chmod a-r bar.trs
  42. $MAKE check
  43. test -f foo.trs
  44. test -r foo.trs
  45. test -f bar.trs
  46. test -r bar.trs
  47. : Again, this time with one .trs file missing and the other
  48. : one unreadable.
  49. rm -f foo.trs
  50. chmod a-r bar.trs
  51. $MAKE check
  52. test -f foo.trs
  53. test -r foo.trs
  54. test -f bar.trs
  55. test -r bar.trs
  56. : Again, but using "make recheck" this time.
  57. rm -f foo.trs
  58. chmod a-r bar.trs
  59. run_make -O recheck
  60. test -f foo.trs
  61. test -r foo.trs
  62. test -f bar.trs
  63. test -r bar.trs
  64. grep '^PASS: foo\.test' stdout
  65. grep '^PASS: bar\.test' stdout
  66. : Recreate by remaking the global test log.
  67. chmod a-r foo.trs
  68. rm -f test-suite.log
  69. run_make -O test-suite.log
  70. test -f foo.trs
  71. test -r foo.trs
  72. grep '^PASS: foo\.test' stdout
  73. grep 'bar\.test' stdout && exit 1
  74. # Also test that have only run before should be counted in the final
  75. # testsuite summary.
  76. grep '^# TOTAL: *2$' stdout
  77. : Setup for the next check.
  78. : > baz.test
  79. sed 's/^TESTS =.*/& baz.test/' Makefile > t
  80. diff t Makefile && exit 99
  81. mv -f t Makefile
  82. $MAKE check
  83. test -f foo.trs
  84. test -f bar.trs
  85. test -f baz.trs
  86. : Interactions with lazy test reruns are OK.
  87. chmod a-r foo.trs
  88. $sleep
  89. touch stamp
  90. $sleep
  91. touch bar.test
  92. run_make -O RECHECK_LOGS= check
  93. test -r foo.trs
  94. is_newest bar.trs bar.test
  95. grep '^PASS: foo\.test' stdout
  96. grep '^PASS: bar\.test' stdout
  97. grep 'baz\.test' stdout && exit 1
  98. # Also test that have only run before should be counted in the final
  99. # testsuite summary.
  100. grep '^# TOTAL: *3$' stdout
  101. :